#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, idx = 0;
  cin >> n;
  int a[n], c[1000] = {0, 0};
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1) {
    cout << "YES";
    return 0;
  }
  for (int i = 0; i < (n - 1); i++) {
    for (int j = (i + 1); j < n; j++) {
      if (a[j] == a[i]) {
        c[i]++;
        idx = i;
      }
    }
  }
  int mx = c[0];
  for (int i = 1; i <= idx; i++) {
    mx = max(mx, c[i]);
  }
  if ((mx + 1) > ((n + 1) / 2))
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
