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