#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, count = 0, a[1010] = {0}, i = 0, temp;
  cin >> n;
  i = n;
  while (n--) {
    cin >> temp;
    a[temp]++;
  }
  for (int j = 0; j < 1001; j++) {
    if (a[j] > count) count = a[j];
  }
  if (i & 1) {
    if (count > i / 2 + 1)
      cout << "NO";
    else
      cout << "YES";
  } else {
    if (count > i / 2)
      cout << "NO";
    else
      cout << "YES";
  }
  return 0;
}
