N = int(input())
a = [int(i) for i in input().split()]

ans_flg = False
for i in range(N):
    if i == N - 1:
        if a[0] + a[N - 2] != a[N - 1]: 
            ans_flg = True
            break
    elif i == 0:
        if a[N - 1] - a[i + 1] != a[i]:
            ans_flg = True
            break

    else:
        if a[i + 1] - a[i - 1] != a[i]: 
            ans_flg = True
            break

if ans_flg:
    print('{}'.format('No'))
else:
    print('{}'.format('Yes'))


