#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) int main() { int N; cin >> N; if (N == 1) { cout << "YES" << endl; return 0; } else if (N == 2) { string a, b; cin >> a >> b; if (a == b) cout << "NO" << endl; else cout << "YES" << endl; return 0; } map<string, int> A; rep(i, 0, N) { string a; cin >> a; A[a]++; } for (pair<string, int> p : A) { if (N - p.second < (p.second - 1)) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; }