i=input N=int(i()) X=sorted(map(int,i().split())) Y=set([X[i+1]-X[i] for i in range(N-1)]) y=Y.pop() print(('NO','YES')[y!=0 and Y=={}])