#include <bits/stdc++.h>   using namespace std;   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     long long cnt[1001] = {};     for (long long i = 0; i < n; ++i) {       long long x;       cin >> x;       cnt[x]++;       if (cnt[x] > (n + 1) / 2) {         cout <<  NO ;         return 0;       }     }     cout <<  YES ;     return 0;   }   