n = int(input()) A = sorted(list(map(int,input().split()))) if len(set(A))!=n: print('NO') else: dis = A[1]-A[0] flg = True for i in range(1, n): if A[i] - A[i-1] != dis: flg = False break print('YES' if flg else 'NO')