#include <bits/stdc++.h>
using namespace std;
bool binary(vector<int> v, int key) {
  int lo = 0, hi = v.size() - 1;
  while (lo <= hi) {
    int mid = (lo + hi) / 2;
    if (v[mid] == key)
      return true;
    else if (v[mid] < key)
      lo = mid + 1;
    else
      hi = mid - 1;
  }
  return false;
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first == b.first)
    return a.second > b.second;
  else
    return a.first < b.first;
}
long long fact(long long n) {
  if (n == 1 || n == 0)
    return 1;
  else
    return n * fact(n - 1);
}
set<string> b;
void permutations(string str, int i, int n) {
  if (i == n - 1) {
    b.insert(str);
    return;
  }
  for (int j = i; j < n; j++) {
    swap(str[i], str[j]);
    permutations(str, i + 1, n);
    swap(str[i], str[j]);
  }
}
bool compp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second > b.second;
}
int main() {
  int n;
  cin >> n;
  vector<int> v(n), ss;
  set<int> s;
  for (int i = 0; i < n; i++) cin >> v[i], s.insert(v[i]);
  vector<pair<int, int>> vec;
  for (int i : s) {
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if (v[j] == i) cnt++;
    }
    vec.push_back(make_pair(i, cnt));
  }
  sort(vec.begin(), vec.end(), compp);
  if (n % 2 == 0) {
    if (vec[0].second > n / 2)
      cout << "NO";
    else
      cout << "YES";
  } else {
    if (vec[0].second > ceil(n / 2.0))
      cout << "NO";
    else
      cout << "YES";
  }
  return 0;
}
