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