#include <bits/stdc++.h>
using namespace std;
struct card {
  string name;
  int time;
  string type;
  int number;
};
int main() {
  while (1) {
    int n;
    cin >> n;
    int a[103];
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      mp[a[i]]++;
    }
    map<int, int>::iterator it = mp.begin();
    int Max = 0;
    for (; it != mp.end(); ++it) Max = max(Max, it->second);
    int res = n - Max;
    if (res >= Max || res == Max - 1)
      cout << "YES" << endl;
    else
      cout << "NO\n";
    return 0;
  }
}
