#include using namespace std; int n; string s; map d; int main() { cin >> n; for(int i = 0; i < n; i++) { cin >> s; d[s]++; } bool ok = true; for(pair i : d) { if(i.second > n / 2 + n % 2) ok = false; } cout << (ok ? "YES" : "NO") << endl; return 0; }