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