from collections import Counter n=int(input()) m=max(Counter(input() for _ in range(n)).values()) if m>(n+1)//2: print('NO') else: print('YES')