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