#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> dem(1000);
  int maxx = INT_MIN;
  for (int i = 0; i < n; ++i) {
    int u;
    cin >> u;
    dem[--u]++;
    maxx = max(maxx, dem[u]);
  }
  if (n - maxx < maxx - 1)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
