#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; ++i) {
    cin >> vec[i];
  }
  sort(vec.begin(), vec.end());
  int cnt = 1, mx_cnt = -1;
  for (int i = 1; i < n; ++i) {
    if (vec[i] == vec[i - 1])
      cnt++;
    else
      cnt = 1;
    mx_cnt = max(mx_cnt, cnt);
  }
  if (mx_cnt <= (n + 1) / 2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
