N = int(input()) lsx = list(map(int,input().split())) lsx.sort() d = lsx[1]-lsx[0] for i in range(N-1): if d == lsx[i+1]-lsx[i]: continue print('NO') exit() print('YES')