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