N = int(input()) A = list(set(map(int, input().split()))) for i in range(len(A)): if A.count(A[i]) > N // 2: print("NO") exit() print("YES")