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