from collections import Counter n=int(input()) a=[] for i in range(n): a.append(input()) count=Counter(a) count_i=max(count.values()) zan=n-count_i if zan<=a: print("YES") else: print("NO")