#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
using ld = long double;
const lli MOD = (int)1e9 + 7;
const lli MOD1 = (int)1e9 + 9;
const lli MOD2 = 998244353;
const ld pi = atan2(0, -1);
const ld eps = 1e-9;
lli tests = 1;
template <class x, class y>
x max(x a, y b) {
  return (a > b) ? a : b;
}
template <class x, class y>
x min(x a, y b) {
  return (a < b) ? a : b;
}
template <class x, class y>
x log(x n, y r) {
  return (n > r - 1) ? 1 + LOG(n / r, r) : 0;
}
void testcase() {}
void solve() {
  lli n;
  cin >> n;
  lli a[n], h[100000] = {0};
  for (lli i = 0; i < n; i++) {
    cin >> a[i];
    h[a[i]]++;
  }
  sort(h, h + 100000);
  reverse(h, h + 100000);
  if (h[0] > ((n + 1) / 2))
    cout << "NO";
  else
    cout << "YES";
}
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  testcase();
  for (lli test = 1; test <= tests; test++) {
    solve();
  }
  return 0;
}
