from collections import Counter N = int(raw_input()) n = max(Counter(raw_input() for i in xrange(N)).values()) print "YES" if n*2 <= N + 1 else "NO"