#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
int n;
int cnt[1001]{};
void input() {
  cin >> n;
  int mVal = 0;
  for (int i = 1; i <= (int)n; i++) {
    int temp;
    cin >> temp;
    mVal = max(mVal, ++cnt[temp]);
  }
  if (mVal <= (n + 1) / 2)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  input();
  return 0;
}
