i=input N=int(i()) X=sorted(map(int,i().split())) Y={X[i+1]-X[i] for i in range(N-1)} print(('NO','YES')[0 not in Y and len(Y)==1])