#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; int N, ma; map mp; int main() { cin >> N; for (int i = 0; i < N; i++) { string A; cin >> A; mp[A]++; } if (N % 2 == 1) { ma = N / 2 + 1; } else { ma = N / 2; } for (auto p: mp) { if (p.second > ma) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }