from collections import defaultdict n = int(input()) mx = 0 dd = defaultdict(int) for i in range(n): a = input() dd[a] += 1 mx = max(mx, dd[a]) if n % 2: mx -= 1 if mx * 2 <= n: print("YES") else: print("NO")