n=int(input()) if n%2==0: mc=n//2 else: mc=n//2+1 sls=[] lsc=[] for i in range(n): sls.append(input()) for i in range(len(sls)): lsc.append(sls.count(sls[i])) dist=max(lsc) if dist <= mc: print("YES") else: print("NO")