#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, p;
  cin >> n;
  unordered_map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> p;
    m[p]++;
  }
  if (n == 1) {
    cout << "YES\n";
    return 0;
  }
  bool possible = true;
  int thold = (n >> 1) + (n & 1);
  for (auto pr : m) {
    if (pr.second > thold) {
      possible = false;
      break;
    }
  }
  cout << (possible ? "YES\n" : "NO\n");
  return 0;
}
