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