from collections import Counter n = int(input()) a = [input() for i in range(n)] cnt = Counter(a) ma = max(cnt.values()) if ma <= n // 2: print("YES") else: print("NO")