#include <bits/stdc++.h>
using namespace std;
int ar[1003] = {0};
int main() {
  int t, n, num;
  scanf("%d", &n);
  int f = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &num);
    ar[num]++;
    if (ar[num] > ((n + 1) / 2)) f = 1;
  }
  if (f)
    cout << "NO\n";
  else
    cout << "YES\n";
  ;
  return 0;
}
