N = int(input()) L = [input() for _ in range(N)] L2 = [L.count(i) for i in L] print(['NO', 'YES'][(N+1)//2 >= max(L2)])