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