#!/usr/bin/env python3
#fileencoding: utf-8
from math import ceil

N = int(input().strip())
eto = {}
eto_max = -1
for i in range(N):
    key = input().strip()
    eto[key] = eto.get(key, 0) + 1
    if eto[key] > eto_max:
        eto_max = eto[key]

if eto_max > ceil(N/2.0):
    print("NO")
else:
    print("YES")