N = int(input()) A = list(map(int,input().split())) for i in range(N): if(A[0] + A[N-1] != A[i] + A[N-i-1]): print("No") exit(0) print("Yes")