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