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