#include #define rep(i,n) for(int i=0;i<(n);++i) #define all(a) (a).begin(),(a).end() using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector S(n); rep(i, n) cin >> S[i]; sort(all(S)); vector T = S; auto result = unique(all(S)); S.erase(result, S.end()); int res = 0; int k = 0; rep(i, S.size()) { k = count(all(T), S[i]); res = max(res, k); k = 0; } if (n % 2 == 0) { if (res >= n / 2 + 1) cout << "NO" << endl; else cout << "YES" << endl; } else { if (res >= (n + 1) / 2 + 1) cout << "NO" << endl; else cout << "YES" << endl; } return 0; }