#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> nrs;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    nrs[x]++;
  }
  int max_times = nrs.begin()->second;
  for (auto it : nrs) max_times = max(it.second, max_times);
  if (max_times > (n + 1) / 2)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}
