#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  int mx = -1;
  int j;
  for (auto x : mp) mx = max(mx, x.second);
  if (mx + mx - 1 <= n)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
