import collections import sys count = collections.Counter tgts = [] for _ in range(int(raw_input())): i = raw_input() tgts.append(swap[i]) #print count(tgts) noise = sorted(count(tgts).values()).pop() ents = sum(count(tgts).values()) - noise if noise >= ents + 2: print "NO" sys.exit(0) print "YES"