from collections import Counter N = int(input()) c = Counter(input() for _ in range(N)) lim = (N + 1) // 2 ma = c.most_common(1)[0][1] print('YES' if ma <= lim else 'NO')