# No.349 干支の置き物 import math n = int(input()) a = [] kinds = [] counts = [] for i in range(n): s = input() a.append(s) if s not in kinds: kinds.append(s) for tmp in kinds: counts.append(a.count(tmp)) print('YES' if max(counts) <= math.ceil(n // 2) + 1 else 'NO')