n=int(input()) lsx=list(map(int,input().split())) lsx.sort() flg=0 for i in range(1,len(lsx)-1): s1=lsx[i]-lsx[i-1] s2=lsx[i+1]-lsx[i] if s1!=s2 or s1==0: flg=1 if flg==1: print("NO") else: print("YES")