#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t = 1, i;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (i = 0; i < n - 1; i++) {
    if (a[i + 1] == a[i]) {
      t++;
    } else if (t > (n + 1) / 2) {
      cout << "NO";
      return 0;
    } else
      t = 1;
  }
  if (t > ((n + 1) / 2))
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
