The programming competition season has already started and it's time to train for ICPC. Sereja coaches his teams for a number of year and he knows that to get ready for the training session it's not enough to prepare only problems and editorial. As the training sessions lasts for several hours, teams become hungry. Thus, Sereja orders a number of pizzas so they can eat right after the end of the competition.

Teams plan to train for n times during n consecutive days. During the training session Sereja orders exactly one pizza for each team that is present this day. He already knows that there will be a_{i} teams on the i-th day.

There are two types of discounts in Sereja's favourite pizzeria. The first discount works if one buys two pizzas at one day, while the second is a coupon that allows to buy one pizza during two consecutive days (two pizzas in total).

As Sereja orders really a lot of pizza at this place, he is the golden client and can use the unlimited number of discounts and coupons of any type at any days.

Sereja wants to order exactly a_{i} pizzas on the i-th day while using only discounts and coupons. Note, that he will never buy more pizzas than he need for this particular day. Help him determine, whether he can buy the proper amount of pizzas each day if he is allowed to use only coupons and discounts. Note, that it's also prohibited to have any active coupons after the end of the day n.


-----Input-----

The first line of input contains a single integer n (1 ≤ n ≤ 200 000) — the number of training sessions.

The second line contains n integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 10 000) — the number of teams that will be present on each of the days.


-----Output-----

If there is a way to order pizzas using only coupons and discounts and do not buy any extra pizzas on any of the days, then print "YES" (without quotes) in the only line of output. Otherwise, print "NO" (without quotes).


-----Examples-----
Input
4
1 2 1 2

Output
YES

Input
3
1 0 1

Output
NO



-----Note-----

In the first sample, Sereja can use one coupon to buy one pizza on the first and the second days, one coupon to buy pizza on the second and the third days and one discount to buy pizzas on the fourth days. This is the only way to order pizzas for this sample.

In the second sample, Sereja can't use neither the coupon nor the discount without ordering an extra pizza. Note, that it's possible that there will be no teams attending the training sessions on some days.

Difficulty: EASY

Solutions:
n = int(input())
a = list(map(int, input().split()))
possible = True
prev = 0
for i in range(n):
	v = a[i] - prev
	if v < 0:
		possible = False
	v %= 2
	prev = v
if prev == 0 and possible:
	print('YES')
else:
	print('NO')


n = int(input())
commands = list(map(int, input().split()))
use_cupon = [0] * n
for i in range(n):
	day = commands[i]
	need_to_buy = day - use_cupon[i]
	if need_to_buy < 0:
		print('NO')
		exit()
	if need_to_buy >= 2:
		need_to_buy %= 2
	if i < n - 1:
		use_cupon[i + 1] += need_to_buy
	elif need_to_buy:
		print('NO')
		exit()
print('YES')


input()
from functools import reduce
print('YES' if reduce(lambda x, y: -1 if y < x or x < 0 else x ^ y & 1, map(int, input().split()), 0) == 0 else 'NO')


t = 0
k = 0
n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
	if a[i] != 0:
		if a[i] % 2 != 0:
			t = t + 1
			k = k + 1
	elif t % 2 != 0:
		t = 0
if k > t or k % 2 != 0:
	print('NO')
else:
	print('YES')


istrue = True
n = int(input())
mas = list(map(int, input().split()))
mas.append(0)
for i in range(n):
	if mas[i] % 2 == 0:
		continue
	elif mas[i] % 2 != 0 and mas[i + 1] > 0:
		mas[i + 1] += 1
	else:
		istrue = False
if istrue:
	print('YES')
else:
	print('NO')


def check(a):
	for i in range(len(a) - 1):
		if a[i] < 0:
			return False
		if a[i] % 2 == 1:
			a[i] -= 1
			a[i + 1] -= 1
	if a[len(a) - 1] % 2 == 0:
		return True
	else:
		return False
n = int(input())
a = [int(i) for i in input().split()]
if check(a):
	print('YES')
else:
	print('NO')


import math, sys, re, itertools, pprint
(ri, rai) = (lambda : int(input()), lambda : list(map(int, input().split())))
n = ri()
a = rai()
f = False
kupon = False
for i in range(n):
	if a[i] == 0:
		if kupon:
			f = True
	elif a[i] % 2 == 1:
		if kupon:
			kupon = False
		else:
			kupon = True
print('NO' if f or kupon else 'YES')


N = int(input())
A = list(map(int, input().split()))
total = sum(A)
if total % 2 != 0:
	print('NO')
	exit()
for i in range(N):
	if A[i] == 0:
		continue
	elif A[i] % 2 == 0:
		A[i] = 2
	else:
		A[i] = 1
for i in range(N):
	if A[i] < 0:
		print('NO')
		exit()
	elif A[i] == 0:
		continue
	elif A[i] == 1:
		A[i] = 0
		if i + 1 <= N - 1:
			A[i + 1] -= 1
	else:
		A[i] = 0
for i in range(N):
	if A[i] < 0:
		print('NO')
		exit()
print('YES')


n = int(input())
days = input().split()
for i in range(n):
	days[i] = int(days[i])
works = True
for i in range(n):
	if days[i] < 0:
		works = False
		break
	if days[i] % 2 == 1:
		if i == n - 1:
			works = False
			break
		else:
			days[i + 1] -= 1
if works:
	print('YES')
else:
	print('NO')


import sys
n = int(input())
arr = list(map(int, input().split()))
res = 'NO'
store = 0
for i in range(n):
	if arr[i] % 2 == 1:
		if store == 0:
			store = arr[i] % 2
		else:
			store = (arr[i] - 1) % 2
			res = 'YES'
	elif arr[i] % 2 == 0 and arr[i] != 0:
		if store == 0:
			res = 'YES'
		else:
			store = (arr[i] - 1) % 2
			res = 'YES'
	elif arr[i] == 0 and store == 1:
		res = 'NO'
		break
if store > 0:
	print('NO')
else:
	print('YES')


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]

def even(arr, n):
	for i in range(n):
		if arr[i] % 2 != 0:
			return False
	return True
n = INT()
arr = LIST()
if even(arr, n):
	print('YES')
	exit(0)
flag = True
c = 0
for i in arr:
	if c > 0 and i == 0:
		flag = False
		break
	c = (i + c) % 2
if flag and c > 0:
	flag = False
if flag:
	print('YES')
else:
	print('NO')


col = input()
text = input()
text = '0 ' + text + ' 0'
z = text.split(' ')
z = [int(z[i]) for i in range(len(z))]
q = True
r = 0
t = False
for i in range(len(z)):
	if z[i] == 0:
		if r % 2 == 1:
			q = False
		t = False
		r = 0
	if z[i] > 0 or t:
		t = True
		r += z[i]
if q == True:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
left = 0
mistake = False
for i in range(len(a)):
	if not left:
		if a[i] % 2 == 1:
			left = 1
	elif a[i] % 2 == 0 and a[i] != 0:
		left = 1
	elif a[i] % 2 == 1:
		left = 0
	elif a[i] == 0:
		mistake = True
if left or mistake:
	print('NO')
else:
	print('YES')


days = int(input())
teams = [int(x) for x in input().split(' ')]
remains = 0
for y in range(days):
	if y == 0 and teams[0] % 2 == 1:
		remains = 1
	elif teams[y] == 0 and remains == 1:
		remains = 1
		break
	elif y == days - 1 and remains == 1 and (teams[y] % 2 == 0):
		remains = 1
		break
	elif remains == 1 and teams[y] % 2 == 1:
		remains = 0
	elif remains == 0 and teams[y] % 2 == 1:
		remains = 1
if remains == 0:
	print('YES')
else:
	print('NO')


n = int(input())
sessions = list(map(int, input().split()))
total_number = 0
for i in sessions:
	total_number += i
	if i == 0:
		if total_number % 2 == 1:
			print('NO')
			exit()
if total_number % 2 == 1:
	print('NO')
else:
	print('YES')


n = int(input())
L = [int(x) for x in input().split()]
L.append(0)
possib = True
for i in range(n):
	if L[i] < 0:
		possib = False
		break
	if L[i] & 1:
		L[i + 1] -= 1
if L[-1] < 0:
	possib = False
if possib:
	print('YES')
else:
	print('NO')


def solution():
	n = int(input())
	numbers = list(map(int, input().split()))
	for i in range(n - 1):
		if numbers[i] % 2 == 1:
			if numbers[i + 1] > 0:
				numbers[i] -= 1
				numbers[i + 1] -= 1
			else:
				print('NO')
				return
	if numbers[-1] % 2 == 0:
		print('YES')
	else:
		print('NO')
solution()


n = input()
c = [int(x) for x in input().split()]
p = 0
d = True
for i in c:
	if i % 2 == 0:
		if p == 1:
			if i == 0:
				d = False
	else:
		p = 1 - p
print('YES' if d and p == 0 else 'NO')


n = int(input())
a = [[int(x) for x in i.strip().split()] for i in input().split(' 0')]
a = [i for i in a if i]
print(['NO', 'YES'][all((sum(x) % 2 == 0 for x in a))])


n = int(input())
val = [int(x) for x in input().split()]
for i in range(n - 1):
	if val[i] < 0:
		print('NO')
		exit()
	if val[i] & 1:
		val[i + 1] -= 1
if val[n - 1] & 1:
	print('NO')
else:
	print('YES')


n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	if i != n - 1:
		if x[i] % 2 != 0:
			x[i] -= 1
			x[i + 1] -= 1
			if x[i + 1] < 0:
				print('NO')
				break
	elif i == n - 1:
		if x[i] % 2 != 0:
			print('NO')
		else:
			print('YES')


n = int(input())
a = list(map(int, input().split()))
f = 0
c = 0
for i in range(n):
	if a[i] > 0:
		c = c + a[i]
	else:
		if c % 2 != 0:
			f = 1
			break
		c = 0
if c % 2 != 0 or f == 1:
	print('NO')
else:
	print('YES')


days_nr = int(input())
day_idx___teams_nr = [int(x) for x in input().split()]
curr_accum_sum = 0
for teams_nr in day_idx___teams_nr:
	if teams_nr == 0:
		if curr_accum_sum % 2 == 1:
			print('NO')
			exit()
		else:
			curr_accum_sum = 0
	else:
		curr_accum_sum += teams_nr
if curr_accum_sum % 2 == 1:
	print('NO')
else:
	print('YES')


n = int(input())
arr = [int(i) for i in input().split()]
result = True
for i in range(n):
	if arr[i] % 2 == 1:
		if i < n - 1 and arr[i + 1] > 0:
			arr[i + 1] -= 1
		else:
			result = False
			break
if result:
	print('YES')
else:
	print('NO')


n = int(input())
a = [int(i) for i in input().strip().split()]
discount = 0
for i in range(len(a)):
	a[i] -= discount
	if a[i] >= 0:
		rem = a[i] % 2
	else:
		break
	if rem == 1:
		discount = 1
	else:
		discount = 0
if discount:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] != -1:
		if a[i] % 2 == 0:
			continue
		elif i == n - 1:
			print('NO')
			exit()
		else:
			a[i + 1] -= 1
	else:
		print('NO')
		exit()
print('YES')


n = int(input())
s = input()
l = s.split()
a = []
la = len(l)
for i in range(la):
	a.append(int(l[i]))
for i in range(la - 1):
	if a[i] < 0:
		print('NO')
		quit()
	if a[i] & 1 == 1:
		a[i + 1] -= 1
if a[la - 1] < 0 or a[la - 1] & 1 == 1:
	print('NO')
	quit()
print('YES')


I = input
I()
a = 0
for x in map(int, I().split()):
	x -= a
	a = x % 2
	if x < 0:
		break
print('YNEOS'[a::2])


sessions = int(input())
teams = [int(x) for x in input().split()]
for i in range(len(teams)):
	if teams[i] % 2 == 0 and teams[i] > 0:
		teams[i] = 2
	if teams[i] % 2 == 1:
		teams[i] = 1
possible = True
for i in range(len(teams)):
	if teams[i] == 1:
		if i + 1 < len(teams) and teams[i + 1] > 0:
			teams[i] = 0
			teams[i + 1] -= 1
for i in range(len(teams)):
	if teams[i] == 1:
		possible = False
if possible:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split())) + [0]
for x in range(n):
	if a[x] < 0:
		print('NO')
		break
	if a[x] % 2 == 0:
		continue
	else:
		a[x + 1] -= 1
else:
	print('YES' if a[-1] >= 0 else 'NO')


def solve(n, seq):
	seq.append(None)
	index = 0
	while index < n:
		if seq[index] % 2 != 0:
			if seq[index + 1] == None or seq[index + 1] < 1:
				return 'NO'
			else:
				seq[index + 1] -= 1
		index += 1
	return 'YES'
n = int(input())
seq = list(map(int, input().split()))
print(solve(n, seq))


n = int(input())
a = list(map(int, input().split()))
i = 0
cnt = 0
ok = True
while i < n:
	if a[i] == 0:
		if cnt % 2 == 1:
			ok = False
			break
		else:
			cnt = 0
	else:
		cnt += a[i]
	i += 1
if not ok or cnt % 2 == 1:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] % 2 != 0:
		if i == n - 1:
			print('NO')
			exit(0)
		a[i] -= 1
		a[i + 1] -= 1
		if a[i] < 0 or a[i + 1] < 0:
			print('NO')
			exit()
print('YES')


N = int(input())

def solve2(stirng):
	nums = list(map(int, string.split()))
	odd = 0
	for num in nums:
		if odd:
			num -= 1
			odd = 0
			if num < 0:
				return 'NO'
		if num % 2:
			odd = 1
	if odd:
		return 'NO'
	else:
		return 'YES'
string = input()
print(solve2(string))


def solution(ns):
	for i in range(len(ns)):
		if i == len(ns) - 1 or ns[i] % 2 == 0:
			continue
		if ns[i] >= 1 and ns[i + 1] >= 1:
			ns[i] -= 1
			ns[i + 1] -= 1
	for n in ns:
		if n % 2 != 0:
			return 'NO'
	return 'YES'
n = input()
ns = list(map(int, input().split(' ')))
print(solution(ns))


_ = input()
a = list(map(int, input().split()))

def doIt():
	for (i, c) in enumerate(a):
		if c % 2 == 1:
			if len(a) > i + 1:
				if a[i + 1] > 0:
					a[i + 1] -= 1
				else:
					return 'NO'
			else:
				return 'NO'
	return 'YES'
print(doIt())


n = int(input())
a = list(map(int, input().split())) + [0]
ss = 0
ans = True
for it in a:
	if it == 0:
		ans = ans and ss % 2 == 0
		ss = 0
	ss += it
print('YES' if ans else 'NO')


__author__ = 'Think'

def f(k):
	if k == 0:
		return 0
	elif k % 2 == 1:
		return 1
	else:
		return 2
n = int(input())
teams = [f(int(i)) for i in input().split()]
coupon = False
working = True
for i in teams:
	if coupon:
		if i == 0:
			working = False
			break
		else:
			i -= 1
	coupon = i % 2 == 1
if not coupon and working:
	print('YES')
else:
	print('NO')


n = int(input())
res = 0
for x in list(map(int, input().split())):
	if x % 2:
		res ^= 1
	elif x == 0 and res > 0:
		print('NO')
		exit()
print(['YES', 'NO'][res])


N = int(input())
Ais = [int(x) for x in input().split()]
odd = False
stop = False
for a in Ais:
	if a == 0 and odd == True:
		print('NO')
		stop = True
		break
	elif a % 2 == 1:
		odd = not odd
if not stop:
	if odd:
		print('NO')
	else:
		print('YES')


n = int(input())
arr = [int(i) for i in input().split()]
ans = 0
for i in arr:
	ans += i
if ans % 2 != 0:
	print('NO')
elif n == 1:
	if arr[0] % 2 == 0:
		print('YES')
	else:
		print('NO')
else:
	flag = 0
	for i in range(0, n - 1):
		if arr[i] < 0:
			flag = 1
			break
		arr[i] %= 2
		if arr[i] == 1:
			arr[i] = 0
			arr[i + 1] -= 1
	if flag == 1:
		print('NO')
	elif arr[n - 1] < 0 or arr[n - 1] % 2 != 0:
		print('NO')
	else:
		print('YES')


import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(nums):
	remain = 0
	for n in nums:
		if remain > n:
			print('NO')
			return False
		n -= remain
		n %= 2
		if n == 1:
			remain = 1
		else:
			remain = 0
	if remain == 0:
		print('YES')
	else:
		print('NO')

def main():
	input()
	line = input().split()
	line = list(map(int, line))
	solve(line)

def log(*message):
	logging.debug(message)
main()


n = int(input())
teams = [int(x) for x in input().split()]
carrying = 0
no_team = False
for i in range(n):
	if teams[i] == 0 and carrying == 1:
		print('NO')
		exit()
	if teams[i] % 2 == 1:
		if carrying == 0:
			carrying = 1
		else:
			carrying = 0
if carrying == 0:
	print('YES')
else:
	print('NO')


n = int(input())
arr = [0 if int(num) == 0 else 2 if int(num) % 2 == 0 else 1 for num in input().split()]
arr.append(0)
for i in range(len(arr) - 1):
	if arr[i] == 1 and arr[i + 1] == 0:
		print('NO')
		exit()
	elif arr[i] == 1:
		arr[i] -= 1
		arr[i + 1] -= 1
	elif arr[i] == 2:
		arr[i] = 0
print('YES')


n = int(input())
a = list(map(int, input().split()))
a.append(0)
for i in range(n + 1):
	if a[i] < 0:
		print('NO')
		return
	a[i] %= 2
	if a[i] == 1:
		a[i + 1] -= 1
print('YES')


n = int(input())
d = input().split()
d = [int(x) for x in d]
B = True
for i in range(len(d)):
	if i == len(d) - 1:
		if d[i] % 2 == 1:
			print('NO')
			B = False
	elif d[i] % 2 > 0:
		d[i + 1] -= 1
		if d[i + 1] < 0:
			print('NO')
			B = False
			break
if B:
	print('YES')


n = int(input())
l = list(map(int, input().split()))
v = 0
for i in range(n):
	l[i] = l[i] - v
	v = l[i] % 2
	if l[i] < 0:
		break
if v % 2 == 0:
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	xs = [int(x) for x in input().split()]
	xs.insert(0, 0)
	xs.append(0)
	for i in range(1, n + 1):
		if xs[i] % 2 == 1:
			if xs[i + 1] > 0:
				xs[i] -= 1
				xs[i + 1] -= 1
	for i in range(1, n + 1):
		if xs[i] % 2 == 0:
			xs[i] = 0
	if all((x == 0 for x in xs)):
		print('YES')
	else:
		print('NO')
main()


I = lambda : map(int, input().split())
n = I()
a = list(I())
key = 1
yp = 0
for d in a:
	temp0 = d - yp
	if temp0 < 0:
		key = 0
		break
	yp = temp0 % 2
if key and (not yp):
	print('YES')
else:
	print('NO')


n = int(input())
lst = [int(i) for i in input().split()]

def main(lst):
	for i in range(len(lst) - 1):
		if lst[i] % 2 == 1:
			lst[i] -= 1
			lst[i + 1] -= 1
		if lst[i] < 0:
			return 'NO'
		if lst[i + 1] < 0:
			return 'NO'
	if lst[len(lst) - 1] % 2 == 1:
		return 'NO'
	return 'YES'
print(main(lst))


n = int(input())
arr = map(int, input().split())
last = 0
for c in arr:
	if last == 0:
		last = c % 2
	elif last == 1:
		if c == 0:
			print('NO')
			exit()
		else:
			last = c - 1 & 1
if last == 1:
	print('NO')
else:
	print('YES')


N = int(input())
arr = list(map(int, input().split()))
if N == 1:
	if arr[0] % 2 == 0:
		print('YES')
	else:
		print('NO')
else:
	flag = True
	for i in range(N - 1):
		if arr[i] < 0:
			flag = False
			break
		if arr[i] == 0:
			continue
		if arr[i] % 2 == 1:
			arr[i + 1] -= 1
			arr[i] = 0
		elif arr[i] % 2 == 0:
			arr[i] = 0
	if not flag:
		print('NO')
	elif arr[-1] >= 0 and arr[-1] % 2 == 0:
		print('YES')
	else:
		print('NO')


n = int(input())
commands = list(map(int, input().split()))
p = 0
b = 0
for i in range(n):
	if i == n - 1:
		print('NO' if commands[n - 1] % 2 == 1 else 'YES')
		continue
	if commands[i] < 0:
		print('NO')
		break
	if commands[i] % 2 == 1:
		commands[i + 1] -= 1


def solve(xs):
	n = len(xs)
	for i in range(n - 1):
		if xs[i] % 2 != 0:
			if xs[i + 1] > 0:
				xs[i + 1] -= 1
			else:
				return False
	return xs[n - 1] % 2 == 0
n = int(input())
a = [int(s) for s in input().split()]
print('YES' if solve(a) else 'NO')


i = int(input())
l = list(map(int, input().split()))
c = 0
for x in l:
	if c == 1:
		x -= 1
	if x < 0:
		print('NO')
		exit()
	c = x % 2
print('NO' if c == 1 else 'YES')


N = int(input())
c = [int(x) for x in input().split(' ')]
lastOff = False
for day in c:
	day = day - 1 if lastOff else day
	if day < 0:
		print('NO')
		exit()
	day %= 2
	lastOff = day == 1
print('NO' if lastOff else 'YES')


from math import inf, sqrt, floor, ceil
from collections import Counter, defaultdict, deque
from heapq import heappush as hpush, heappop as hpop, heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left, bisect_right
n = int(input())
a = list(map(int, input().split()))
cunt = 0
for i in range(n - 1):
	if a[i] == 0:
		continue
	if a[i] <= 0:
		cunt = 1
		print('NO')
		break
	if a[i] & 1:
		a[i + 1] -= 1
if not cunt:
	if a[n - 1] & 1:
		print('NO')
	else:
		print('YES')


n = int(input())
ps = [int(x) for x in input().split(' ')]
f = True
for i in range(n):
	if ps[i] % 2 == 1:
		if i == n - 1 or ps[i + 1] == 0:
			f = False
			break
		else:
			ps[i + 1] -= 1
print('YES' if f else 'NO')


time = int(input())
teams = [int(x) for x in input().split()]
r = True
for i in range(time - 1):
	if teams[i] < 0:
		r = False
	teams[i + 1] -= teams[i] % 2
if teams[time - 1] % 2 == 1:
	r = False
print('YES' if r else 'NO')


from sys import stdin, stdout
n = int(stdin.readline())
counting = list(map(int, stdin.readline().split()))
for i in range(n):
	if counting[i] % 2:
		counting[i] = 1
	elif counting[i]:
		counting[i] = 2
label = 1
for i in range(n - 1, 0, -1):
	if not counting[i]:
		continue
	elif counting[i] == 2:
		counting[i] = 0
	elif counting[i - 1]:
		counting[i] = 0
		counting[i - 1] -= 1
	else:
		label = 0
if label and (not counting[0] % 2):
	stdout.write('YES')
else:
	stdout.write('NO')


n = int(input())
days = list(map(int, input().split()))
answ = True
must = False
for day in days:
	if must:
		day -= 1
		if day >= 0:
			if day % 2:
				must = True
			else:
				must = False
		else:
			answ = False
	elif day % 2:
		must = True
if answ and (not must):
	print('YES')
else:
	print('NO')


import sys
n = int(input())
input = sys.stdin.readline()
ar = list(map(int, input.split()))
sums = [0]
for i in range(n):
	if ar[i] == 0:
		sums.append(0)
	else:
		sums[-1] += ar[i]
flag = 1
for x in sums:
	if x % 2 != 0:
		print('NO')
		flag = 0
		break
if flag:
	print('YES')


n = int(input())
sessions_orig = [int(sdfg) for sdfg in input().split()]
sessions = []
for s in sessions_orig:
	if s == 0:
		sessions.append(0)
		continue
	if s % 2 == 1:
		sessions.append(1)
	if s % 2 == 0:
		sessions.append(2)
for ses in range(n - 1):
	if sessions[ses] == 1:
		if sessions[ses + 1] != 0:
			sessions[ses] -= 1
			sessions[ses + 1] -= 1
		else:
			print('NO')
			exit()
	elif sessions[ses] == 0:
		continue
	elif sessions[ses] == 2:
		sessions[ses] -= 2
if sessions[n - 1] == 1:
	print('NO')
	exit()
print('YES')


n = int(input())
arr = list(map(int, input().split()))
flag = False
coupon = [False] * n
for i in range(n):
	if flag:
		arr[i] -= 1
	if arr[i] < 0:
		print('NO')
		exit(0)
	if arr[i] % 2 == 0:
		flag = False
	else:
		flag = True
if not flag:
	print('YES')
else:
	print('NO')


n = int(input())
l = [*map(int, input().split())]
for i in range(1, n):
	l[i] -= l[i - 1] & 1
res = min(l) >= 0 and l[-1] & 1 == 0
print(['NO', 'YES'][res])


input()
p = 0
for x in map(int, input().split()):
	p = 1 << 20 if x < p else p ^ x & 1
print('NO' if p > 0 else 'YES')


trenings = int(input())
num_of_commands = input()
num_of_commands = num_of_commands.split(' ')
for i in range(len(num_of_commands)):
	num_of_commands[i] = int(num_of_commands[i])
if sum(num_of_commands) % 2 == 1:
	print('NO')
else:
	is_pizza = False
	result = True
	for i in range(len(num_of_commands)):
		if is_pizza:
			num_of_commands[i] -= 1
		if num_of_commands[i] == -1:
			result = False
			break
		if i == len(num_of_commands) - 1 and num_of_commands[i] % 2 == 1:
			result = False
		if num_of_commands[i] % 2 == 0:
			is_pizza = False
		else:
			is_pizza = True
	if result:
		print('YES')
	else:
		print('NO')


n = int(input())
s = list(map(int, input().split()))
cnt = 0
for i in s:
	if i == 0:
		if cnt % 2 == 1:
			print('NO')
			break
		else:
			cnt = 0
	else:
		cnt += i
else:
	if cnt % 2 == 0:
		print('YES')
	else:
		print('NO')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
n = ii()
a = li()
sum_ = 0
for i in range(n):
	if a[i] == 0:
		if sum_ & 1:
			print('NO')
			break
		else:
			sum_ = 0
	else:
		sum_ += a[i]
else:
	if sum_ & 1:
		print('NO')
	else:
		print('YES')


n = int(input())
a = [0] * n
a = list(map(int, input().split()))
a.append(0)
ok = int(0)
for i in range(n):
	if a[i] % 2 == 1:
		if i == n + 1:
			ok = 1
		elif a[i + 1] == 0:
			ok = 1
		else:
			a[i + 1] -= 1
if ok == 0:
	print('YES')
else:
	print('NO')


n = int(input())
tab = input()
tab = list(map(int, tab.split()))
for i in range(len(tab) - 1):
	if tab[i] < 0:
		print('NO')
		exit()
	if tab[i] % 2 == 0:
		tab[i] = 0
	else:
		tab[i] = 0
		tab[i + 1] -= 1
if tab[-1] % 2 == 0:
	print('YES')
else:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
boo = 1
coupons = 0
for i in range(n):
	if arr[i] == 0:
		if coupons == 1:
			boo = 0
			break
	else:
		tt = arr[i] - coupons
		coupons = tt % 2
if coupons == 1:
	boo = 0
if boo == 0:
	print('NO')
else:
	print('YES')


n = int(input())
ar = [int(i) for i in input().split()]
for i in range(n - 1):
	if ar[i] % 2 == 1:
		if ar[i + 1] != 0:
			ar[i + 1] -= 1
		else:
			print('NO')
			exit(0)
if ar[n - 1] % 2 == 0:
	print('YES')
else:
	print('NO')


class CodeforcesTask731BSolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.days = []

	def read_input(self):
		self.n = int(input())
		self.days = [int(x) for x in input().split(' ')]

	def process_task(self):
		can_ = True
		for x in range(self.n):
			if self.days[x] % 2:
				if x < self.n - 1:
					if self.days[x + 1] > 0:
						self.days[x + 1] -= 1
					else:
						can_ = False
						break
				else:
					can_ = False
					break
		self.result = 'YES' if can_ else 'NO'

	def get_result(self):
		return self.result
Solution = CodeforcesTask731BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
l = list(map(int, input().split()))
flag = 1
for i in range(1, n):
	a = l[i - 1]
	b = l[i]
	if a % 2 == 0 and b % 2 == 0:
		continue
	elif a % 2 == 1 and b % 2 == 1:
		l[i] = l[i] - 1
	elif a % 2 == 0 and b % 2 == 1:
		continue
	else:
		l[i] = l[i] - 1
	if l[i] < 0 or l[i - 1] < 0:
		flag = 0
		break
if flag == 0 or l[-1] % 2 == 1:
	print('NO')
else:
	print('YES')


n = int(input())
a = [int(x) for x in input().split()]
for i in range(len(a)):
	if a[i] % 2 == 0 and a[i] > 0:
		a[i] = 2
	if a[i] % 2 == 1:
		a[i] = 1
possible = True
for i in range(len(a)):
	if a[i] == 1:
		if i + 1 < len(a) and a[i + 1] > 0:
			a[i] = 0
			a[i + 1] -= 1
for i in range(len(a)):
	if a[i] == 1:
		possible = False
if possible:
	print('YES')
else:
	print('NO')


N = int(input())
a = list(map(int, input().split()))
pre = 0
for i in range(N):
	if i == 0:
		pre = a[i] % 2
	else:
		if pre == 1 and a[i] == 0:
			print('NO')
			exit()
		mod = a[i] % 2
		if pre == 1 and mod == 1:
			pre = 0
		elif pre == 1 and mod == 0:
			pre = 1
		elif pre == 0 and mod == 1:
			pre = 1
		elif pre == 0 and mod == 0:
			pre = 0
if pre == 1:
	print('NO')
else:
	print('YES')


n = int(input())

def s(a):
	if a != 0:
		return [2, 1][a % 2]
	return 0
L = [s(k) for k in map(int, input().split())]
res = True
if n == 1:
	if L[0] % 2 == 0:
		print('YES')
	else:
		print('NO')
else:
	for k in range(1, n):
		if L[k] == 0:
			if L[k - 1] == 1:
				res = False
				break
			else:
				L[k - 1] = 0
		elif L[k] == 2:
			if L[k - 1] == 1:
				L[k] = 1
			L[k - 1] = 0
		else:
			if L[k - 1] == 1:
				L[k] = 0
			L[k - 1] = 0
	if res:
		if 1 in L:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


input()
p = 0
A = [int(i) for i in input().split(' ')]
r = 'NO'
mn = 0
for i in A:
	if mn == 1:
		i -= mn
		mn = 0
	if i < 0:
		break
	elif i == 0:
		continue
	elif i % 2 != 0:
		mn = 1
else:
	if mn == 1:
		r = 'NO'
	else:
		r = 'YES'
print(r)


import sys
n = int(sys.stdin.readline().replace('\n', ''))
a = [int(x) for x in sys.stdin.readline().replace('\n', '').split(' ')]
ok = True
for (day, teams) in enumerate(a):
	if teams < 0:
		sys.stdout.write('NO')
		ok = False
		break
	elif teams % 2 == 0:
		pass
	elif day + 1 < len(a):
		a[day + 1] -= 1
	else:
		sys.stdout.write('NO')
		ok = False
		break
if ok:
	sys.stdout.write('YES')


n = int(input())
a = list(map(int, input().split()))
cur_pizzas = 0
tomorrow_pizzas = 0
for i in range(n):
	cur_pizzas = tomorrow_pizzas
	tomorrow_pizzas = 0
	if (a[i] - cur_pizzas) % 2 == 0:
		cur_pizzas += (a[i] - cur_pizzas) // 2
	else:
		cur_pizzas += (a[i] - cur_pizzas) // 2 + 1
		tomorrow_pizzas += 1
	if cur_pizzas > a[i]:
		print('NO')
		exit()
if tomorrow_pizzas:
	print('NO')
	exit()
print('YES')


def can_buy(x):
	return sum(x) % 2 == 0

def solution(x):
	t = []
	for k in range(len(x)):
		if x[k] != 0:
			t.append(x[k])
		else:
			if len(t) > 0 and (not can_buy(t)):
				return 'NO'
			t = []
	return 'YES'
N = int(input())
x = list(map(int, input().split())) + [0]
print(solution(x))


n = int(input())
arr = [int(i) for i in input().split()]
for i in range(n):
	if arr[i] % 2 == 0:
		continue
	elif i == n - 1:
		print('NO')
		break
	elif arr[i + 1] <= 0:
		print('NO')
		break
	while arr[i] > 2:
		arr[i] -= 2
	arr[i] -= 1
	arr[i + 1] -= 1
else:
	print('YES')


import sys
n = int(input())
a = list(input().split(' '))
b = [int(n) for n in a]
k = False
for i in range(n):
	if k:
		if b[i] >= 1:
			b[i] -= 1
			k = False
		else:
			print('NO')
			sys.exit()
		b[i] %= 2
		if b[i] == 1:
			k = True
			b[i] -= 1
	else:
		b[i] %= 2
		if b[i] == 1:
			k = True
			b[i] -= 1
if k:
	print('NO')
else:
	print('YES')


n = int(input())
a = [int(i) for i in input().split()]
for i in range(n - 1):
	if a[i] % 2 == 1 and a[i + 1] > 0:
		a[i] -= 1
		a[i + 1] -= 1
	if a[i] % 2 == 0 and a[i] != 0:
		a[i] = 0
a[n - 1] = a[n - 1] % 2
if max(a) == 0:
	print('YES')
else:
	print('NO')


a = int(input())
b = input().strip().split()
carry = 0
cur = 0
for i in b:
	i = int(i)
	if carry == 1:
		if i > 0:
			i = i - 1
		else:
			cur = 1
	if i % 2 == 1:
		carry = 1
	else:
		carry = 0
if carry == 1 or cur == 1:
	print('NO')
else:
	print('YES')


from sys import stdin
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().rstrip().split(' ')))
s = l[0]
s1 = l[0] // 2 * 2
l[0] = l[0] % 2
for i in range(1, n):
	s += l[i]
	if l[i] != 0:
		l[i] = l[i] + l[i - 1]
		s1 += l[i] // 2 * 2
	elif l[i - 1] == 1:
		s1 = -10
		break
	l[i] = l[i] % 2
if l[-1] == 1 or s1 != s:
	print('NO')
else:
	print('YES')


n = int(input())
a = [int(x) for x in input().split()]
if sum(a) % 2 == 1:
	print('NO')
else:
	done = False
	i = 0
	cp = None
	if a[i] % 2 == 0:
		cp = 'E'
	else:
		cp = 'O'
	while not done and i < len(a) - 1:
		if cp == 'O' and a[i + 1] == 0:
			done = True
		elif cp == 'O':
			if a[i + 1] % 2 == 0:
				cp = 'O'
			else:
				cp = 'E'
		elif a[i + 1] % 2 == 0:
			cp = 'E'
		else:
			cp = 'O'
		i += 1
	if done:
		print('NO')
	else:
		print('YES')


from sys import stdin, stdout

def ri():
	return map(int, stdin.readline().split())
n = int(input())
a = list(ri())
for i in range(n - 1):
	(a1, a2) = (a[i], a[i + 1])
	if (a1 + a2) % 2:
		if a2 == 0:
			print('NO')
			exit()
		else:
			a[i + 1] = 1
	else:
		a[i + 1] = 0
if a[n - 1] % 2:
	print('NO')
else:
	print('YES')


n = int(input())
a = list(map(int, input().split()))
for i in range(n - 1):
	if a[i] > 0:
		a[i] %= 2
	if a[i] == 1:
		a[i + 1] -= 1
if a[-1] % 2 != 0:
	a[-1] = -1
if min(a) >= 0:
	print('YES')
else:
	print('NO')


n = int(input())
days = list(map(int, input().split()))
val = 0
for i in range(len(days) - 1):
	a = days[i]
	b = days[i + 1]
	if a > b:
		if a % 2 == 1:
			if b == 0:
				val = 1
				break
			elif b % 2 == 0:
				a = b - 1
			else:
				a = b
		elif b % 2 == 0:
			a = b
		else:
			a = b - 1
	days[i + 1] = b - a
if days[len(days) - 1] % 2 == 1:
	val = 1
if val == 0:
	print('YES')
else:
	print('NO')


from sys import *
n = int(input())
a = [int(z) for z in input().split()]
for i in range(n - 1):
	if a[i] < 0:
		print('NO')
		exit(0)
	a[i] %= 2
	if a[i]:
		a[i + 1] -= 1
if a[n - 1] % 2:
	print('NO')
else:
	print('YES')


n = int(input())
a = [int(i) for i in input().split(' ')]
sum = 0
c = 'YES'
for i in a:
	if i == 0 and sum % 2 != 0:
		break
	else:
		sum += i
if sum % 2 == 0:
	print('YES')
else:
	print('NO')


n = int(input())
A = [int(x) for x in input().split()]
(active, ans) = (False, True)
for i in range(0, n):
	active ^= A[i] % 2 == 1
	if active and A[i] % 2 == 0:
		if A[i] < 2:
			ans = False
ans = ans and sum([i % 2 for i in A]) % 2 == 0
print('YES' if ans else 'NO')


input()
f = 0
for a in map(int, input().split()):
	if f > a:
		break
	f ^= a & 1
print(('YES', 'NO')[f])


def main():
	sessions = int(input())
	data = list(map(int, input().split()))
	for i in range(0, sessions - 1, 1):
		if data[i] < 0:
			data[sessions - 1] = 1
			break
		elif data[i] % 2 == 1:
			data[i + 1] -= 1
	if data[sessions - 1] % 2 == 1:
		print('NO')
	else:
		print('YES')
main()


n = int(input())
data = [int(x) for x in input().split()]
data.append(0)
yes = 1
for x in range(len(data) - 1):
	if data[x] == 0:
		continue
	elif data[x] % 2 == 0 and data[x] > 0:
		data[x] = 0
		continue
	elif data[x + 1] > 0:
		data[x + 1] -= 1
	else:
		yes = 0
if yes == 1:
	print('YES')
else:
	print('NO')


def buyPizza(alist):
	for i in range(len(alist) - 1):
		if alist[i] < 0:
			return 'NO'
		if alist[i] % 2 == 0:
			continue
		else:
			alist[i + 1] -= 1
	if alist[-1] >= 0 and alist[len(alist) - 1] % 2 == 0:
		return 'YES'
	else:
		return 'NO'
a = int(input())
alist = [0 for i in range(a)]
nums = input()
nums = nums.split(' ')
for i in range(a):
	alist[i] = int(nums[i])
print(buyPizza(alist))


k = int(input())
n = list(map(int, input().split()))
n.append(0)
res = True
for i in range(k + 1):
	if n[i] < 0:
		res = False
		break
	if n[i] % 2 == 0:
		continue
	elif i < k:
		n[i + 1] = n[i + 1] - 1
if res:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(input().split(' '))
a = [int(a[i]) for i in range(len(a))]
for i in range(len(a)):
	if a[i] >= 2:
		a[i] -= int(a[i] // 2) * 2
	if i != len(a) - 1 and a[i] == 1:
		a[i] -= 1
		a[i + 1] -= 1
	if a[i] != 0:
		print('NO')
		break
else:
	print('YES')


n = int(input())
l_p = list(map(int, input().split()))
for i in range(len(l_p)):
	if l_p[i] % 2 == 1:
		if i + 1 == len(l_p) or l_p[i + 1] == 0:
			print('NO')
			quit()
		l_p[i + 1] -= 1
print('YES')


n = int(input())
arr = [int(x) for x in input().split()]
arr.append(0)

def iterate(arr):
	for i in range(len(arr)):
		if arr[i] < 0:
			return 0
		elif arr[i] % 2 == 1:
			arr[i + 1] -= 1
	if i == len(arr) - 1:
		return 1

def main():
	ans = iterate(arr)
	if ans == 1:
		print('YES')
	else:
		print('NO')
main()


n = int(input())
a = list(map(int, input().split()))
result = True
coupon = False
for i in range(len(a)):
	if a[i] < 0:
		result = False
		break
	a[i] %= 2
	if a[i] == 1:
		if i < n - 1:
			a[i] -= 1
			a[i + 1] -= 1
		else:
			result = False
			break
if result:
	print('YES')
else:
	print('NO')


n = int(input())
l = [int(i) for i in input().split()]
l.append(0)
for i in range(n + 1):
	if l[i] < 0:
		print('NO')
		exit()
	l[i] = l[i] % 2
	if l[i] == 1:
		l[i + 1] -= 1
print('YES')


def exe():
	n = input()
	active = False
	a = list(map(int, input().split()))
	for i in a:
		if i == 0:
			if active == False:
				continue
			else:
				return False
		if active == True:
			i -= 1
			active = False
			if i % 2 == 0:
				continue
			else:
				if i == 0:
					return False
				active = True
				continue
		elif i % 2 == 0:
			continue
		else:
			active = True
			continue
	return not active
result = exe()
if result == True:
	print('YES')
else:
	print('NO')


n = int(input())
data = [int(i) for i in input().split()]
p = 1
for i in range(n - 1):
	data[i] %= 2
	if data[i] and data[i + 1]:
		data[i] -= 1
		data[i + 1] -= 1
	elif data[i]:
		print('NO')
		p = 0
		break
data[-1] %= 2
if data[-1] and p:
	print('NO')
elif p:
	print('YES')