import collections N = int(input().strip()) A = [input().strip() for _ in range(N)] c = collections.Counter(A) cc = sorted(list(c.items()), key = lambda x : x[1], reverse=True) tmp = [cc[0][1], -(-(N / 2) // 1)] print(['NO', 'YES'][tmp[0] <= tmp[1]])