N = int(input()) x = sorted(list(map(int,input().split()))) d = x[1]-x[0] f = True if d==0: f=False for i in range(N-1): if x[i+1]-x[i]!=d: f=False if f: print("YES") else: print("NO")