#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:20000000")
using namespace std;
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
long long rll() {
  long long x;
  scanf("%I64d", &x);
  return x;
}
int mas[1050];
void solve() {
  int n = ri();
  for (int i = (int)(1); i <= (int)(n); i++) mas[ri()]++;
  for (int i = (int)(1); i <= (int)(1000); i++)
    if (mas[i] > (n + 1) / 2) {
      cout << "NO" << endl;
      return;
    }
  cout << "YES" << endl;
}
int main() {
  solve();
  return 0;
}
