AAA = input() BBB = [raw_input() for i in range(AAA)] CCC = list(set(BBB)) DDD = [0 for i in range(len(CCC))] for i in range(len(CCC)): for j in range(AAA): if BBB[j] == CCC[i]: DDD[i] += 1 EEE = sorted(DDD) if AAA%2 == 0: if EEE[0] <= AAA/2: print "YES" else: print "NO" else: if EEE[0] <= AAA/2+1: print "YES" else: print "NO"