#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> h;
  h.resize(2000);
  int n, a;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    h[a]++;
  }
  sort(h.begin(), h.end());
  reverse(h.begin(), h.end());
  if (n % 2 == 1) n++;
  if (h[0] > n / 2)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
