#include <bits/stdc++.h>
using namespace std;
long long int i, t = 1, j, temp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    long long int n, k = 0;
    cin >> n;
    long long int a[n];
    map<int, long long int> m;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      m[a[i]]++;
    }
    map<int, long long int>::iterator itr;
    for (itr = m.begin(); itr != m.end(); itr++) {
      if (k < (itr->second)) {
        k = itr->second;
      }
    }
    if (n % 2) {
      (k <= ((n + 1) / 2)) ? cout << "YES" : cout << "NO";
    } else {
      (k <= (n / 2)) ? cout << "YES" : cout << "NO";
    }
  }
  return 0;
}
