# -*- coding: utf-8 -*- import collections N = input() Elist = [] for i in range(N): Elist.append(raw_input()) count_dict = collections.Counter(Elist) maxdec = count_dict.most_common(1) maxn = maxdec[0][1] bound = N // 2 + N % 2 if bound < maxn: print "NO" else: print "YES"