input() a=sorted(map(int,input().split())) print("YES"if len({j-i for i,j in zip(a[:-1],a[1:])if j-i})==1else"NO")