from collections import * N = int(input()) A = [input() for _ in range(N)] cnt = Counter(A) M = max(list(cnt.values())) if M>(N+1)//2: print('NO') else: print('YES')