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