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