#include <bits/stdc++.h>
using namespace std;

int main(){
    map<string,int> eto;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        eto[s]++;
    }
    int ans = 0;
    for(auto a:eto) ans = max(ans,a.second);
    if(n - ans >= ans - 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}