#include <bits/stdc++.h>
using namespace std;
int arr[107];
int n = 0;
int c[1001];
bool valid() {
  for (int i = 0; i < 1001; i++) {
    if (c[i] > 0 &&
        ((n % 2 == 0 && c[i] > n / 2) || (n % 2 == 1 && c[i] > (n + 1) / 2)))
      return false;
  }
  return true;
}
int main() {
  cin >> n;
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    c[arr[i]]++;
  }
  if (valid())
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
