from collections import defaultdict n = int(input()) counter = defaultdict(int) for _ in range(n): a = input() counter[a] += 1 for cnt in counter.values(): if cnt > (n + 1) // 2: print("NO") exit() print("YES")