N=int(input()) A=[input() for _ in range(N)] mx=max(set(A),key=A.count) print(('NO','YES')[A.count(mx)<=N//2+1])