n=int(input()) lst=sorted(map(int,input().split())) tmp=lst[1]-lst[0] for i in range(1,n-1): if lst[i+1]-lst[i]==0:print("NO");exit() if tmp!=lst[i+1]-lst[i]:print("NO");exit() print("YES")