#include #include using namespace std; int main(void) { int n; cin >> n; map mp; string s; int max_num = 0; for (int i = 0; i < n; ++i) { cin >> s; ++mp[s]; max_num = max(max_num, mp[s]); } if (n - max_num >= max_num - 1) cout << "YES" << endl; else cout << "NO" << endl; return 0; }