n = int(input()) A = sorted(map(int,input().split())) x = [xi - xj for xi, xj in zip(A[:-1], A[1:])] s = set(x) print(["NO","YES"][len(s)==1 and 0 not in s])