#include <bits/stdc++.h>
using namespace std;
void solve() {}
int main() {
  int n;
  cin >> n;
  vector<int> v;
  set<int> s;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    v.push_back(t);
    s.insert(t);
    m.insert(make_pair(t, ++m[t]));
  }
  int f = 0;
  for (int i = 0; i < n; i++) {
    if (m[v[i]] > (n + 1) / 2) {
      f = 1;
      break;
    }
  }
  if (f == 0)
    cout << "YES";
  else
    cout << "NO";
}
