n = input() dic = {} for i in range(n): tmp = raw_input() if tmp not in dic: dic[tmp] = 1 else: dic[tmp] += 1 keys = dic.keys() maxes = 0 for i in keys: if maxes < dic[i]: maxes = dic[i] a = (n - maxes) / maxes == 0 if a % 3 == 1: print "NO" else: print "YES"