#include <bits/stdc++.h>

using namespace std;


#define REP(i, n) for(int i = 0; i < n; i++)


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    map<string, int> mp;
    REP(i, n) {
        string s;
        cin >> s;
        mp[s]++;
    }

    int mpMax = 0;
    for (auto i:mp) {
        mpMax = max(mpMax, i.second);
    }

    if (n - mpMax + 1 > mpMax) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}