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: interview

Starter code:

Solutions:
n=input()
c=[int(x) for x in input().split()]
p=0
d=True
for i in c:
    #print(p,d,i)
    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')

#!/usr/bin/env python3


def main():
    try:
        while True:
            n = int(input())
            rem = False
            for x in map(int, input().split()):
                if x & 0x1:
                    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())
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())
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")


__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())
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=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")


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


#!/usr/bin/env python3

def __starting_point():
  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')


__starting_point()

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


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)


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(map(int, input().split()))
total = sum(A)
if total % 2 != 0:
    print("NO")
    return

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")
        return
    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")
        return

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

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
        else:
            if a[i]%2==1:
                a[i+1]-=1
    if a[n-1]%2==1:
        k=1
    if k==1:
        print("NO")
    else:
        print("YES")


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


from collections import defaultdict
import sys, os, math

def __starting_point():
    #n, m = list(map(int, input().split()))
    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()

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

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)


I = lambda: list(map(int, input().split()))
n, a = I()[0], I()
active_coupon = False
for i in range(n):
    #order quantity after last active coupon if exists
    q = a[i] - 1*active_coupon
    if q >= 0:
        #check whether needs second coupon
        r = q % 2
        #must use second coupon
        active_coupon = [True, False][r!=1]
    else:
        #negative order quantity
        active_coupon = True
        break
print('YNEOS'[active_coupon::2])

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")
else:
    if 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")
        else:
            if arr[n-1]<0 or arr[n-1]%2!=0:
                print("NO")
            else:
                print("YES")


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)