#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, tmp, meow = -1;
  cin >> n;
  map<int, int> mp;
  map<int, int>::iterator it;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    mp[tmp]++;
  }
  for (it = mp.begin(); it != mp.end(); it++) {
    if (meow < (it->second)) meow = it->second;
  }
  if (2 * (meow - 1) < n || n == 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
