import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; public class Main_yukicoder349 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Map hm = new HashMap<>(); for (int i = 0; i < n; i++) { String s = sc.next(); if (hm.containsKey(s)) { hm.put(s, hm.get(s) + 1); } else { hm.put(s, 1); } } boolean flag = true; for (Entry e : hm.entrySet()) { if (e.getValue() -1 > n - e.getValue()) { flag = false; break; } } if (flag) { System.out.println("YES"); } else { System.out.println("NO"); } sc.close(); } }