input() A=sorted(map(int,input().split())) print(['NO','YES'][len({y-x for x,y in zip(A,A[1:])if y-x})==1])