#include #include #include #include #include using namespace std; typedef long long int ll; typedef pair pii; #define REP(i,x) for(int i=0;i<(int)(x);i++) int main(){ int t; cin >> t; map m; REP(i, t) { string s; cin >> s; m[s]++; } vector v; for(auto r : m) { v.push_back(r.second); } sort(v.begin(), v.end()); if(t % 2 == 1) { if(v.back() > t / 2 + 1) { cout << "NO" << endl; return 0; } cout << "YES" << endl; return 0; } if(v.back() > t / 2) { cout << "NO" << endl; return 0; } cout << "YES" << endl; return 0; }