n = int(input()) l = [input() for _ in range(n)] l2 = [l.count(i) for i in l] print(['NO', 'YES'][max(l2) <= (n+1) // 2])