#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int ar[100000], br[10000];
  memset(br, 0, sizeof(br));
  for (long long int i = 1; i <= n; i++) {
    cin >> ar[i];
    br[ar[i]]++;
  }
  sort(ar + 1, ar + n + 1);
  if (n == 1) {
    cout << "YES" << endl;
  } else if (ar[1] == ar[n]) {
    cout << "NO" << endl;
  } else {
    int f = 0;
    sort(br + 1, br + 10000, greater<long long int>());
    for (long int i = 1; i <= n; i++) {
      if (br[i] > (n + 1) / 2) {
        f = 1;
      }
    }
    if (f == 0) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
}
