import java.util.HashMap; import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap list = new HashMap(); for (int i = 0; i < n; i++) { String s = sc.next(); if (list.containsKey(s)) { //System.out.println("あるn"); list.put(s, list.get(s) + 1); } else { //System.out.println("ないn"); list.put(s, 1); } } sc.close(); System.out.println(solve(list, (n + 1) / 2) ? "YES" : "NO"); } public static boolean solve (HashMap list, int lim) { for (String s : list.keySet()) { //System.out.println(list.get("saru") + " , " + lim); if (list.get(s) > lim) return false; } return true; } }