// No.349 干支の置き物 // https://yukicoder.me/problems/no/349 // #include #include using namespace std; string solve(unordered_map &items, int N); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int N; cin >> N; unordered_map items; for (auto i = 0; i < N; ++i) { string tmp; cin >> tmp; ++items[tmp]; } string ans = solve(items, N); cout << ans << endl; } string solve(unordered_map &items, int N) { if (N % 2 == 0) { for (auto i: items) { if (i.second * 2 >= N) return "NO"; } } else { for (auto i: items) { if (i.second * 2 > N) return "NO"; } } return "YES"; }