#include <bits/stdc++.h>
using namespace std;
const int N = 2000;
int n, t;
int a[N];
bool ops;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    ++a[t];
    if (a[t] > (n + 1) / 2) ops = true;
  }
  cout << (ops ? "NO" : "YES");
  return 0;
}
