#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int value;
    cin >> value;
    a.push_back(value);
  }
  sort(a.begin(), a.end());
  int current, max = 0, count = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      current = a[i];
      count++;
    } else {
      if (a[i] == current)
        count++;
      else {
        if (count > max) max = count;
        current = a[i];
        count = 1;
      }
    }
  }
  if (count > max) max = count;
  if (max <= (n + 1) / 2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
