#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, l, f = 0;
  cin >> n;
  l = ceil(double(n) / 2.00);
  vector<int> a(n);
  map<int, int> m;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
    m[a[i]]++;
  }
  for (auto x : m) {
    if (x.second > l) {
      f = 1;
      break;
    }
  }
  if (f)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
