N = int(input()) xs = sorted(list(map(int, input().split()))) nw = xs[1] itv = nw - xs[0] if itv == 0: print('NO') else: for i in range(1, N-1): nxt = xs[i+1] if nxt - nw == itv: continue else: print('NO') break nw = nxt else: print('YES')