from collections import Counter N = int(input()) L = [input() for _ in range(N)] d = Counter(L) print(['NO', 'YES'][(N+1)//2 >= max(d.values())])