s=[input() for i in'.'*int(input())] m=max([s.count(x) for x in s]) print('YNEOS'[1+len(s)//2