N = int(input()) xs = list(map(int, input().split())) xs.sort() d = xs[1] - xs[0] for i in range(2, N): if xs[i] - xs[i - 1] != d or d == 0: print('NO') break else: print('YES')