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
Tags: Greedy algorithms

Constructive algorithms
Skill types: Greedy algorithms

Starter code:

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())
a = list(map(int, input().split()))
for (i, j) in enumerate(a):
	if j % 2:
		if i + 1 < n:
			if a[i + 1] == 0:
				print('NO')
				break
			a[i + 1] -= 1
		else:
			print('NO')
			break
else:
	print('YES')


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')


input()
teams = [int(i) for i in input().split()]
works = 'YES'
r = 0
for i in teams:
	if i == 0 and r:
		works = 'NO'
	r = (i % 2 + r) % 2
if r:
	works = 'NO'
print(works)


n = int(input())
teams = [int(x) for x in input().split()]
res = 'YES'
diff = 0
for team in teams:
	if diff > 0 and team == 0:
		res = 'NO'
		break
	diff = (team + diff) % 2
if res == 'YES' and diff > 0:
	res = 'NO'
print(res)


n = int(input())
l = list(map(int, input().split()))
carrier = 0
for i in range(n):
	if l[i] == 0 and carrier == 1:
		print('NO')
		exit()
	if l[i] % 2 == 1:
		if carrier == 0:
			carrier = 1
		else:
			carrier = 0
if carrier == 0:
	print('YES')
else:
	print('NO')


from collections import defaultdict
import sys, os, math

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


def solve(n, data):
	for i in range(n - 1):
		if data[i] < 0:
			return 'NO'
		if data[i] % 2:
			data[i + 1] -= 1
		else:
			pass
	if data[n - 1] % 2:
		return 'NO'
	return 'YES'
n = int(input())
data = [int(x) for x in input().split()]
print(solve(n, data))


n = int(input())
s = [int(i) for i in input().split()]
t = 0
for i in s:
	if i - t < 0:
		print('NO')
		break
	t = (i - t) % 2
else:
	if t:
		print('NO')
	else:
		print('YES')


(N, Teams, Temp) = (int(input()), list(map(int, input().split())), 0)
for i in range(N):
	if Teams[i] < Temp:
		print('NO')
		exit()
	else:
		Temp = (Teams[i] - Temp) % 2
if Temp != 0:
	print('NO')
else:
	print('YES')


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	A = Scanner.map_int()
	for i in range(N):
		if A[i] % 2 == 0:
			A[i] %= 2
		if A[i] > 0:
			if i + 1 < N and A[i + 1] > 0:
				A[i] -= 1
				A[i + 1] -= 1
			else:
				return False
	return True

def main():
	print('YNEOS'[not solve()::2])
main()


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


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


n = int(input())
a = list(map(int, input().split()))
s = 0
flag = 1
for i in range(n):
	s += a[i]
	if a[i] == 0 and s & 1:
		flag = 0
		break
if flag and (not s & 1):
	print('YES')
else:
	print('NO')


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


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()
n = I()
a = IL()
a = [1 if aa % 2 else min(aa, 2) for aa in a]
for i in range(n - 1):
	a[i] = a[i] % 2
	ma = min(a[i], a[i + 1])
	a[i] -= ma
	a[i + 1] -= ma
print('YES' if sum([aa % 2 for aa in a]) == 0 else 'NO')


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


from sys import stdout
n = int(input())
k = list(map(int, input().split()))
prev = 0
for i in range(0, len(k)):
	if k[i] < 1 and prev == 1:
		break
	prev = (prev + k[i]) % 2
out = 'YES' if prev == 0 else 'NO'
stdout.write(out)


I = lambda : list(map(int, input().split()))
(n, a) = (I()[0], I())
active_coupon = False
for i in range(n):
	q = a[i] - 1 * active_coupon
	if q >= 0:
		r = q % 2
		active_coupon = [True, False][r != 1]
	else:
		active_coupon = True
		break
print('YNEOS'[active_coupon::2])


def use_coupons(A):
	for i in range(len(A) - 1):
		if A[i] % 2 == 1:
			if A[i + 1] == 0:
				return False
			else:
				A[i + 1] -= 1
	if A[len(A) - 1] % 2 == 1:
		return False
	return True
n = input()
n = int(n)
A = input()
A = A.split()
for i in range(n):
	A[i] = int(A[i])
if use_coupons(A):
	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')


input()
c = 0
for a in map(int, input().split()):
	a -= c
	c = a % 2
	if a < 0:
		break
print('NO' if c else 'YES')


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')


def main():
	from sys import stdin, stdout
	it = iter(map(int, stdin.read().split()))
	n = next(it)
	offset = False
	for _ in range(n):
		ai = next(it)
		if offset and ai == 0:
			break
		if offset:
			ai += 1
			offset = False
		if ai & 1:
			offset = True
	stdout.write('NO\n' if offset else 'YES\n')
main()


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


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


def gogo():
	for i in range(n):
		a[i] %= 2
		if a[i] == 1:
			if i + 1 >= n or a[i + 1] == 0:
				return 0
			else:
				a[i + 1] -= 1
	return 1
n = int(input())
a = [int(x) for x in input().split()]
if gogo():
	print('YES')
else:
	print('NO')


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


def coupons_and_discounts():
	no_days = int(input())
	teams = [int(x) for x in input().strip().split(' ')]
	teams.append(0)
	flag_coupon = False
	for i in range(no_days):
		if flag_coupon:
			teams[i] -= 1
			flag_coupon = False
		if teams[i] % 2 != 0 and teams[i + 1] == 0:
			return 'NO'
		elif teams[i] % 2 != 0:
			flag_coupon = True
	return 'YES'
print(coupons_and_discounts())


n = int(input())
a = [int(x) for x in input().split()]
cur = False
for i in range(0, n):
	if a[i] % 2 == 1:
		cur = cur ^ True
	elif a[i] == 0 and cur == True:
		break
if cur == True:
	print('NO')
else:
	print('YES')


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])


from sys import stdin
n = int(stdin.readline())
a = [int(x) for x in stdin.readline().split()]
pizza_free_today = False
result = 'NO'
for teams in a:
	if pizza_free_today:
		teams -= 1
		pizza_free_today = False
	if teams < 0:
		break
	if teams % 2 == 0:
		pass
	else:
		pizza_free_today = True
else:
	if not pizza_free_today:
		result = 'YES'
print(result)


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')


odd = 0
invalid = 0
w = input()
a = [a.strip() for a in input().split(' ')]
for i in range(0, len(a), 1):
	x = int(a[i])
	if odd:
		if x > 1 and x % 2 == 0:
			odd = 1
		elif x > 0:
			odd = 0
		else:
			invalid = 1
	elif x % 2 == 1:
		odd = 1
if invalid or odd:
	print('NO\n')
else:
	print('YES\n')


n = input()
d = [int(i) for i in input().split()]
s = 0
result = 'YES'
for i in d:
	if i == 0:
		if s % 2 != 0:
			result = 'NO'
			break
	s += i
if s % 2 != 0:
	result = 'NO'
print(result)


__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())
a = [int(x) for x in input().split()]
a.append(0)
for i in range(len(a)):
	if a[i] >= 2:
		if a[i] % 2 == 0:
			a[i] = 0
		else:
			a[i] = 1
	if a[i] == 1 and a[i + 1] >= 1:
		a[i] -= 1
		a[i + 1] -= 1
	elif a[i] == 0:
		pass
	else:
		print('NO')
		exit()
print('YES')


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


n = int(input())
arr = [int(x) for x in input().split()]
crr = []
hap = 0
for x in arr:
	if x == 0:
		crr.append(hap)
		hap = 0
	else:
		hap += x
crr.append(hap)
for x in crr:
	if x % 2:
		print('NO')
		exit()
print('YES')


def main():
	try:
		while True:
			n = int(input())
			rem = False
			for x in map(int, input().split()):
				if x & 1:
					rem = not rem
				elif rem and x == 0:
					print('NO')
					break
			else:
				print('NO' if rem else 'YES')
	except EOFError:
		pass
main()


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().strip())
teams = list(map(int, input().strip().split()))
carry = 0
failed = False
for team in teams:
	if carry > team:
		failed = True
		break
	team -= carry
	carry = team % 2
if carry or failed:
	print('NO')
else:
	print('YES')


amount = int(input())
teams = input().split()
teams = [int(t) for t in teams]
future_sell = 0
for i in range(amount):
	if teams[i] == 0 and future_sell != 0:
		break
	if (teams[i] - future_sell) % 2 == 1:
		future_sell = 1
	else:
		future_sell = 0
if future_sell == 1:
	print('NO')
else:
	print('YES')


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


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')


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


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 = [int(i) for i in input().split()]
for i in range(n):
	if a[i] < 0:
		print('NO')
		raise SystemExit
	if a[i] % 2 != 0:
		if i == n - 1:
			print('NO')
			raise SystemExit
		else:
			a[i + 1] -= 1
print('YES')


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')


days = int(input())
teams = list(map(int, input().split(' ')[:days]))
prev = 0
for i in range(len(teams)):
	teams[i] -= prev
	if teams[i] < 0:
		print('NO')
		exit(0)
	teams[i] %= 2
	prev = teams[i]
if prev != 0:
	print('NO')
else:
	print('YES')


n = int(input())
data = list(map(int, input().split()))
n = sum(map(lambda x: x & 1 > 0, data))
if n & 1:
	msg = 'NO'
else:
	flag = False
	msg = 'YES'
	for v in data:
		if not v and flag:
			msg = 'NO'
		elif v & 1 > 0:
			flag = not flag
print(msg)


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


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


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')


import math

def Bad():
	print('NO')
	exit(0)
n = int(input())
a = list(map(int, input().split()))
haveNow = False
for i in range(n):
	if haveNow:
		a[i] -= 1
		haveNow = False
	if a[i] < 0:
		Bad()
	a[i] %= 2
	if a[i]:
		haveNow = True
if haveNow:
	Bad()
print('YES')


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')