#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> howmany(1001, 0);
  int n, max = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    howmany[num]++;
    if (howmany[num] > max) {
      max = howmany[num];
    }
  }
  if (max - (n - max) > 1) {
    cout << "NO";
  } else
    cout << "YES";
  return 0;
}
