#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  ;
  long long a[1001] = {0};
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    ;
    a[x]++;
  }
  long long s = 0;
  for (long long i = 0; i < 1001; i++) s = max(s, a[i]);
  if (2 * s - 1 <= n)
    cout << "YES";
  else
    cout << "NO";
}
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int q;
  q = 1;
  while (q--) {
    solve();
    cout << endl;
  }
  return 0;
}
