N = int(input()) x = list(map(int,input().split())) x.sort() S = set() for i in range(N-1): S.add(x[i+1]-x[i]) if len(S) == 1: print("YES") else: print("NO")