N = int(input()) L = list(map(int, input().split())) l = L[0] + L [-1] f = "Yes" for n in range(N): if L[n] + L[N - n - 1] != l: f = "No" print(f)