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