import collections N = int(input()) ANIMALS = [] for i in range(N): ANIMALS.append(input()) CA = collections.Counter(ANIMALS) for v in CA.values(): if v>N//2+1: print('NO') exit() print('YES')