n=input() a=[raw_input()for i in range(n)] s=None for i in range(n): a=sorted(a,key=lambda x:-a.count(x)) for j in range(len(a)): if s!=a[j]: s=a[j] a.pop(j) break else: print"NO" break else: print"YES"