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