import math
n = int(input())
li = {}
counts = []
for i in range(n):
    v = input()
    if not v in li:
        li[v] = 1
    else:
        li[v] = li[v] + 1

for i in li.values():
    counts.append(i)

if max(counts) <= math.floor(n / 2):
    print('YES')
else:
    print('NO')