import sys
N = int(input())
a_lis = [int(_) for _ in input().split()]

def func(x, y):
    if (x == 1 and y == 1) or (x == 0 and y == 0):
        return 0
    elif (x == 0 and y == 1) or (x == 1 and y == 0):
        return 1

def finish(ans, a_lis_item):
    if ans != (a_lis_item % 2):
        print('No')
        sys.exit()

for i, a in enumerate(a_lis):
    if i == 0:
        ans = func(a_lis[N - 1] % 2, a_lis[1] % 2)
    elif i == N - 1:
        ans = func(a_lis[0] % 2, a_lis[N - 2] % 2)
    else:
        ans = func(a_lis[i - 1] % 2, a_lis[i + 1] % 2)
    finish(ans, a_lis[i])

print('Yes')