#include <bits/stdc++.h>
using namespace std;
int freq[1001];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, num;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> num;
    freq[num]++;
  }
  string res = "YES\n";
  for (int i = 0; i < 1001; i++)
    if (freq[i] > ceil(n / 2.0)) {
      res = "NO\n";
      break;
    }
  cout << res;
  return 0;
}
