import collections N = int(input()) A = [input() for _ in range(N)] _, cnts = zip(*collections.Counter(A).most_common()) if len(cnts) > 1 and (N >= 2*cnts[0]-1): print("YES") else: print("NO")