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