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