import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); HashMap map = new HashMap(); for(int i = 0; i < N; i++) { String s = sc.next(); if(map.containsKey(s)) { map.put(s, map.get(s) + 1); } else { map.put(s, 1); } } ArrayList list = new ArrayList(); for(String s : map.keySet()) { list.add(map.get(s)); } Collections.sort(list); int max = list.get(list.size() - 1); String ans = "NO"; int sum = 0; for(int i = 0; i < list.size() - 1; i++) { sum += list.get(i); } if(sum >= max - 1) ans = "YES"; System.out.println(ans); } }