n = int(input()) S = [input()for x in '_'*n] d = {} for i in S: if i in d: d[i] += 1 else: d[i] = 1 m = 0 for i in d.values(): if i>m : m = i print('NO'if n//2+n%2 else'YES')