from collections import Counter N = int(input()) cnt = Counter(input() for i in [0] * N) print("NO" if max(cnt.values()) > (N + 1) //2 else "YES")