import collections N = int(input()) A = [input() for _ in range(N)] _, cnts = zip(*collections.Counter(A).most_common()) if len(cnts) == 1: if cnts[0] == 1: print("YES") else: print("NO") else: wk = 0 for x in reversed(cnts): if wk != 0 and wk+1 < x: print("NO") break wk += x else: print("YES")