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