import collections n = int(input()) a = [input() for _ in range(n)] cnt = collections.Counter(a) d = max(cnt.values()) if d <= (n + 1) // 2: print('YES') else: print('NO')