N = int(input())
x = list(map(int,input().split()))
x.sort()

S = set()
for i in range(N-1):
	S.add(x[i+1]-x[i])

if len(S) == 1 and 0 not in S:
	print("YES")
else:
	print("NO")