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