N = int(input()) A = [input() for i in range(N)] M = A.count(max(set(A),key=A.count)) if M > (N+1)/2: print("NO") else: print("YES")