#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  map<long long int, long long int> mp;
  for (int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    mp[x]++;
  }
  int pos = (n + 1) / 2;
  string res = "YES";
  for (auto it = mp.begin(); it != mp.end(); it++) {
    if (it->second > pos) {
      res = "NO";
      break;
    }
  }
  cout << res << "\n";
}
