n = int(input()) dic = {} for i in range(n): a = input() if a not in dic: dic[a] = 1 else: dic[a] += 1 maxd = max(dic.items(), key=lambda x: x[1]) if maxd[1] % 2 == 1: if (n + 1) / 2 >= maxd[1]: print('YES') else: print('NO') else: if (n + 1) / 2 >= maxd[1]: print('YES') else: print('NO')