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