N = int(input())
A = list(map(int,input().split()))
flg = 0


if(A[0]%2==(A[1]+A[-1])%2):
    flg += 1
    
A.append(A[0])


for i in range(1,N):
    if(A[i]%2 == (A[i-1]+A[i+1])%2):
        flg += 1



if(flg == N):
    print("Yes")
else:
    print("No")