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

int main(){
    map <string, int> mp;
    int N, flag = 0;
    string tmp;

    cin >> N;
    while(cin >> tmp){
        mp[tmp]++;
    }

    for(auto itr = mp.begin(); itr != mp.end(); itr++){
        if(N%2 == 0){
            if(itr->second > N/2){
                flag = 1;
                break;
            }
        }else{
            if(itr->second >= N/2){
                flag = 1;
                break;
            }
        }
    }
    if(flag == 1){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }

    return 0;
}