from collections import Counter n,*a = open(0).read().split() d = Counter(a) print("YES" if (int(n)+1)//2 >= max(d.values()) else "NO")