#include <bits/stdc++.h>
using namespace std;
int n, freq[1005], mx;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    freq[x]++;
  }
  mx = *(max_element(freq, freq + 1001));
  if (mx > (n / 2) + (n % 2) && n > 1)
    cout << "NO\n";
  else
    cout << "YES\n";
  return 0;
}
