from collections import Counter n = int(input()) e_list = [] for i in range(n): e_list.append(input()) count = Counter(e_list) if count.most_common()[0][1] > (n+1)//2: msg = 'NO' else: msg = 'YES' print(msg)