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