#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    m[k]++;
  }
  int l = 0;
  for (auto i : m) {
    if (i.second > l) {
      l = i.second;
    }
  }
  if (n % 2 == 0) {
    if (l > n / 2) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  } else {
    if (l > ((n / 2) + 1)) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
  return 0;
}
