n = int(input()) l = [input() for _ in range(n)] s = "YES" for i in set(l): if l.count(i)>n/2+n%2: s = "NO" print(s)