#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v;
  int count[1005];
  memset(count, 0, sizeof(count));
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    count[x]++;
    v.push_back(x);
  }
  int max = 0;
  for (int i = 0; i < n; i++) {
    if (count[v[i]] > max) {
      max = count[v[i]];
    }
  }
  if (max > (n + 1) / 2)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}
