from collections import Counter n=int(input()) count=Counter(input() for i in [0]*n) if max(count.values())>(n+1)//2: print("NO") else: print("YES")