package yukicoder;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class No349 {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashMap<String,Integer> map = new HashMap<String, Integer>();
    
        for (int i = 0; i < n; i++) {
        	String eto = sc.next();
        	if (map.containsKey(eto)) {
        		map.put(eto, map.get(eto) + 1);
        	} else {
        		map.put(eto, 1);
        	}
        }
        int max = 0;
        for(Entry<String, Integer> e : map.entrySet()) {
            if(max < e.getValue()) {
            	max = e.getValue();
            }
        }
        if ((n+1)/2 >= max) {
        	System.out.println("YES");
        }else {
        	System.out.println("NO");
        }

	}

}