n = int(input()) A = [str(input()) for _ in range(n)] from collections import Counter C = Counter(A) V = list(C.values()) V.sort(reverse=True) if len(V) == 1: print('NO') else: if sum(V[1:]) >= V[0]-1: print('YES') else: print('NO')