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