import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import Counter N = int(readline()) A = read().split() counter = Counter(A) n = counter.most_common(n=1)[0][1] answer = 'YES' if n <= (N+1)//2 else 'NO' print(answer)