from collections import defaultdict N = int(input()) C = defaultdict(int) for _ in range(N): A = input() C[A] += 1 for CNT in C.values(): if CNT > (N + 1) // 2: print("NO") exit(0) print("YES")