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