import collections n = int(input()) a_list = [input() for i in range(n)] a_clc = collections.Counter(a_list) max_num = a_clc.most_common()[0][1] res = 0 if n % 2 == 0: if max_num <= int(n / 2): res = 1 else: if max_num <= int((n + 1) / 2): res = 1 if res == 1: print('YES') else: print('NO')