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