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