#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  map<long long, long long> a;
  for (long long i = 0; i < n; i++) {
    long long t;
    cin >> t;
    a[t]++;
  }
  for (auto &i : a) {
    if (i.second > (n + 1) / 2) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
