#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    map<int, int> cnt;
    int mc = 0;
    for (int i = (0); i <= ((n)-1); ++i) {
      int x;
      cin >> x;
      ++cnt[x];
      mc = max(mc, cnt[x]);
    }
    if (n == 1) {
      cout << "YES" << endl;
    } else {
      if (n < 2 * mc - 1) {
        cout << "NO" << endl;
      } else {
        cout << "YES" << endl;
      }
    }
  }
  return 0;
}
