import sys
from collections import Counter

n = int(sys.stdin.readline())
arr = [sys.stdin.readline().strip() for _ in range(n)]
counts = Counter(arr)
max_count = max(counts.values())
if max_count > (n + 1) // 2:
    print("NO")
else:
    print("YES")