from collections import Counter N = int(input()) A = [int(input()) for _ in range(N)] cnt = Counter(A) if cnt.most_common(1)[0][1] > -(-N//2): print("NO") else: print("YES")