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