n=input() x=sorted(list(map(int,input().split())));s=x[1]-x[0] for i in range(2,len(x)): if s!=x[i]-s or s==0: print('NO');exit() print('YES')