from collections import Counter n = int(input()) c = Counter([input() for _ in range(n)]) print("YES" if c.most_common()[0][1] < n - 1 else "NO")