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