Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?

Given an integer sequence a_1, a_2, ..., a_{n} of length n. Decide whether it is possible to divide it into an odd number of non-empty subsegments, the each of which has an odd length and begins and ends with odd numbers.

A subsegment is a contiguous slice of the whole sequence. For example, {3, 4, 5} and {1} are subsegments of sequence {1, 2, 3, 4, 5, 6}, while {1, 2, 4} and {7} are not.


-----Input-----

The first line of input contains a non-negative integer n (1 ≤ n ≤ 100) — the length of the sequence.

The second line contains n space-separated non-negative integers a_1, a_2, ..., a_{n} (0 ≤ a_{i} ≤ 100) — the elements of the sequence.


-----Output-----

Output "Yes" if it's possible to fulfill the requirements, and "No" otherwise.

You can output each letter in any case (upper or lower).


-----Examples-----
Input
3
1 3 5

Output
Yes

Input
5
1 0 1 5 1

Output
Yes

Input
3
4 3 1

Output
No

Input
4
3 9 9 3

Output
No



-----Note-----

In the first example, divide the sequence into 1 subsegment: {1, 3, 5} and the requirements will be met.

In the second example, divide the sequence into 3 subsegments: {1, 0, 1}, {5}, {1}.

In the third example, one of the subsegments must start with 4 which is an even number, thus the requirements cannot be met.

In the fourth example, the sequence can be divided into 2 subsegments: {3, 9, 9}, {3}, but this is not a valid solution because 2 is an even number.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
n = int(input())
A = list(map(int, input().split()))
if len(A) % 2 == 1:
	if A[0] % 2 == 1 and A[len(A) - 1] % 2 == 1:
		print('Yes')
		exit()
	else:
		print('No')
		exit()
if A[0] % 2 == 0 or A[len(A) - 1] % 2 == 0:
	print('No')
	exit()
print('No')


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = ii1()
arr = iia()
if arr[0] % 2 != 0 and arr[-1] % 2 != 0 and (len(arr) % 2 != 0):
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
if n % 2 == 1 and a[0] % 2 == 1 and (a[-1] % 2 == 1):
	print('Yes')
else:
	print('No')


n = int(input())
l = list([int(x) for x in input().split()])
count = 0
if n % 2 != 0 and l[0] % 2 != 0 and (l[n - 1] % 2 != 0):
	print('YES')
else:
	print('NO')


def main():
	N = int(input())
	A = tuple(map(int, input().split()))
	if not len(A) % 2 or not A[0] % 2 or (not A[-1] % 2):
		ans = 'No'
	else:
		ans = 'Yes'
	print(ans)
main()


n = int(input())
arr = [int(x) for x in input().split()]
if n % 2 == 0 or arr[0] % 2 == 0 or arr[n - 1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
a = list(map(int, input().split()))
if a[0] % 2 == 0:
	print('No')
else:
	f = 0
	for l in range(1, n + 1, 2):
		if n % l == 0 and n // l % 2 == 1:
			i = 0
			j = i + l - 1
			f1 = 0
			while j < n and i < n:
				if a[i] % 2 == 1 and a[j] % 2 == 1:
					i = j + 1
					j = i + l - 1
				else:
					f1 = 1
					break
			if f1 == 0:
				f = 1
				break
		if f == 1:
			break
	if f == 0:
		print('No')
	else:
		print('Yes')


inputCount = int(input())
inputList = [int(x) for x in input().split()]
if inputList[0] % 2 != 0 and inputList[inputCount - 1] % 2 != 0 and (inputCount % 2 != 0):
	print('Yes')
else:
	print('No')


n = int(input())
numbers = list(map(int, input().split()))
if len(numbers) % 2 == 1 and numbers[0] % 2 == 1 and (numbers[n - 1] % 2 == 1):
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
if a[0] % 2 == 0 or a[-1] % 2 == 0:
	print('No')
	exit()
if len(a) % 2 != 0:
	print('Yes')
	exit()
print('No')


n = int(input())
a = input().split()
if int(a[0]) % 2 == 0 or int(a[n - 1]) % 2 == 0 or n % 2 == 0:
	print('No')
	exit()
print('Yes')


n = int(input())
a = list(map(lambda x: int(x) % 2, input().strip().split(' ')))
if n & 1 == 1 and a[0] == 1 and (a[-1] == 1):
	print('yes')
else:
	print('no')


arr_len = int(input())
arr = list(map(int, input().split()))
if arr_len & arr[0] & arr[-1] & 1:
	print('Yes')
else:
	print('No')


n = int(input())
a = [int(i) for i in input().split()]
if n % 2 == 0:
	print('No')
elif a[0] % 2 != 0 and a[len(a) - 1] % 2 != 0:
	print('Yes')
else:
	print('No')


n = int(input())
seq = list(map(int, input().split()))
if n % 2 == 0:
	print('No')
elif seq[0] % 2 == 0 or seq[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


def main():
	i = int(input())
	data = [int(d) for d in input().split()]
	if data[0] % 2 + data[-1] % 2 + i % 2 < 3:
		print('No')
	else:
		print('Yes')
main()


n = int(input())
a = list(map(int, input().split()))
print('YES' if n & a[0] & a[-1] & 1 else 'NO')


n = int(input())
l = list(map(int, input().split()))
if l[0] % 2 != 0 and l[-1] % 2 != 0:
	if n % 2 != 0:
		print('yes')
	else:
		print('no')
else:
	print('no')


l = int(input())
arr = [*map(int, input().split())]
print('Yes' if l % 2 and arr[0] % 2 and arr[-1] % 2 else 'No')


input()
j = 0
l = list(map(int, input().split()))
if l[0] % 2 == 0 or l[len(l) - 1] % 2 == 0:
	print('No')
else:
	for i in range(len(l)):
		if l[i] % 2 == 1:
			if (i - j) % 2 == 0:
				j = i
	print('Yes' if j == len(l) - 1 else 'No')


input()
arr = list(map(int, input().split()))
print(['Yes', 'No'][arr[0] % 2 == 0 or arr[len(arr) - 1] % 2 == 0 or len(arr) % 2 == 0])


import sys
number = int(input())
input2 = [int(x) for x in input().split()]
if number % 2 == 0 or input2[0] % 2 == 0 or input2[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
a = [int(x) for x in input().split()]
if a[0] % 2 == 0 or a[-1] % 2 == 0:
	print('No')
elif n % 2 == 1:
	print('Yes')
else:
	print('No')


line_1 = int(input())
seq = list(map(int, input().split()))
if seq[0] % 2 != 0 and seq[len(seq) - 1] % 2 != 0:
	if line_1 % 2 != 0:
		print('Yes')
	else:
		print('No')
else:
	print('No')


n = int(input())
lis = list(map(int, input().split()))
if n % 2 != 0 and lis[0] % 2 != 0 and (lis[-1] % 2 != 0):
	print('YES')
else:
	print('NO')


def main():
	n = int(input())
	aa = list(map(int, input().split()))
	print(('No', 'Yes')[n & 1 and aa[0] & 1 and aa[-1] & 1])
main()


(N, X) = (int(input()), list(map(int, input().split())))
print('YES' if N % 2 + X[0] % 2 + X[-1] % 2 == 3 else 'NO')


def read_ints():
	return [int(i) for i in input().split()]
n = read_ints()
a = read_ints()
if len(a) % 2 and a[0] % 2 and a[-1] % 2:
	print('Yes')
else:
	print('No')


n = int(input())
arr = list(map(int, input().split()))
if n % 2 == 0 or arr[0] % 2 == 0 or arr[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())

def odd(n):
	return n % 2 == 1
a = list(map(int, input().split()))
if odd(a[0]) and odd(a[-1]) and odd(n):
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
chet = 0
nechet = 0
if a[0] % 2 == 0 or a[n - 1] % 2 == 0:
	print('NO')
	exit()
for el in a:
	if el % 2 == 0:
		chet += 1
	else:
		nechet += 1
if (chet + (nechet - chet * 2)) % 2 == 1:
	print('YES')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
if n % 2 == 0:
	print('NO')
elif l[0] % 2 == 1 and l[-1] % 2 == 1:
	print('YES')
else:
	print('NO')


import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import re
import string
N = int(input())
As = list(map(int, input().split()))
if len(As) % 2 and As[0] % 2 and As[-1] % 2:
	print('Yes')
else:
	print('No')


from math import *

def chop():
	return (int(i) for i in input().split())
n = int(input())
f = False
a = [int(i) for i in input().split()]
if len(a) % 2 == 0 or a[0] % 2 == 0 or a[-1] % 2 == 0:
	f = True
print('Yes' if not f else 'No')


def f(n):
	return n % 2 == 1
n = int(input())
l = list(map(int, input().split()))
if f(n) and f(l[-1]) and f(l[0]):
	print('Yes')
else:
	print('No')


num_lines = int(input())
nums = input().split(' ')
nums = [int(x) for x in nums]
if nums[0] % 2 == 0 or nums[num_lines - 1] % 2 == 0 or num_lines % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
a = list(map(int, input().split()))
f = 0
cnt = 0
if a[0] % 2 == 0 or a[n - 1] % 2 == 0 or n % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
nums = list(map(int, input().split()))
if len(nums) % 2 == 0:
	print('No')
elif nums[0] % 2 == 0 or nums[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
a = list(map(int, input().split(' ')))
pu = False
if a[0] % 2 == 0 or a[-1] % 2 == 0:
	pu = True
if n % 2 == 0 or pu:
	print('No')
else:
	print('Yes')


def re():
	return list(map(int, input().split()))
n = int(input())
a = re()
print('Yes' if a[0] & 1 and a[-1] & 1 and len(a) & 1 else 'No')


n = int(input())
arr = [int(x) for x in input().strip().split(' ')]
if n % 2 == 0:
	print('No')
elif arr[0] % 2 != 0 and arr[n - 1] % 2 != 0:
	print('Yes')
else:
	print('No')


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import re

def tup():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
from math import log2, sqrt
n = I()
ls = lint()
f = True
print('Yes') if ls[0] % 2 == 1 and ls[n - 1] % 2 == 1 and (n % 2 == 1) else print('No')


def odd_and_adds(lst, n):
	if lst[0] % 2 == 1 and lst[n - 1] % 2 == 1 and (n % 2 == 1):
		return 'YES'
	return 'NO'
m = int(input())
a = [int(i) for i in input().split()]
print(odd_and_adds(a, m))


def main():
	n = int(input())
	tab = list(map(int, input().split()))
	if tab[0] % 2 == 1 and tab[n - 1] % 2 == 1 and (n % 2 == 1):
		print('Yes')
	else:
		print('No')
main()


def calcUtil(a, curr, p, n):
	if curr == n:
		if p % 2 == 0:
			return True
		return False
	if a[curr] % 2 == 1:
		for i in range(1, n, 2):
			if curr + i > n:
				break
			if a[curr + i - 1] % 2 == 1:
				val = p
				if curr + i == n:
					val = p
				else:
					val = val + 1
				if calcUtil(a, curr + i, val, n):
					return True
	return False

def calc(a, n):
	if n % 2 == 0:
		return False
	if n == 1:
		return True if a[0] % 2 == 1 else False
	if n % 2 == 1 and a[0] % 2 == 1 and (a[n - 1] % 2 == 1):
		return True
	if a[0] % 2 == 0 or a[-1] % 2 == 0:
		return False
	partition = 0
	return calcUtil(a, 0, partition, n)
n = int(input())
a = list(map(int, input().split()))
print('Yes' if calc(a, n) else 'No')


n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0 or a[0] % 2 == 0 or a[n - 1] % 2 == 0:
	print('No', end='')
else:
	print('Yes', end='')


def isOdd(n):
	return n % 2 == 1

def f(sequence_length, sequence):
	if not isOdd(sequence[0]) or not isOdd(sequence[-1]):
		return False
	if not isOdd(sequence_length):
		return False
	dividers = []
	for i in range(sequence_length - 1):
		if isOdd(sequence[i]) and isOdd(sequence[i + 1]):
			dividers.append(i + 1)
	if not isOdd(len(dividers)):
		return True
	else:
		for i in dividers:
			if not f(i, sequence[0:i]) and f(sequence_length - i, sequence[i:]) or (f(i, sequence[0:i]) and (not f(sequence_length - i, sequence[i:]))):
				return True
		return False
sequence_length = int(input())
sequence = list(map(int, input().split()))
if f(sequence_length, sequence):
	print('Yes')
else:
	print('No')


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

def f():
	if n % 2 == 0:
		return 'NO'
	elif a[0] % 2 == 0 or a[-1] % 2 == 0:
		return 'NO'
	else:
		return 'YES'
print(f())


n = int(input())
l = [int(i) for i in input().split()]
if n & 1:
	if n == 1:
		print('Yes' if l[0] & 1 else 'No')
	elif l[0] & 1 and l[n - 1] & 1:
		print('Yes')
	else:
		print('No')
else:
	print('No')


L = int(input())
A = []
D = input()
D = D.split()
for i in range(L):
	A.append(int(D[i]))

def InicioYFinImpares(A):
	b = False
	a = False
	for i in range(len(A)):
		if i == 0 and A[0] % 2 != 0:
			b = True
		if i == len(A) - 1 and A[len(A) - 1] % 2 != 0:
			a = True
	return a and b
if InicioYFinImpares(A) and L % 2 != 0:
	print('Yes')
else:
	print('No')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	n = I()
	a = LI()
	m = {}

	def f(l, r):
		if l >= r:
			return False
		k = (l, r)
		if k in m:
			return m[k]
		t = a[l:r]
		if t[0] % 2 == 0 or t[-1] % 2 == 0:
			m[k] = (0, 0)
			return (0, 0)
		e = 0
		o = 0
		if len(t) % 2 == 1:
			o = 1
		else:
			e = 1
		for i in range(l + 1, r):
			(lo, le) = f(l, i)
			(ro, re) = f(i, r)
			if lo and re or (le and lo):
				o = 1
			if lo and ro or (le and re):
				e = 1
			if o and e:
				break
		m[k] = (o, e)
		return (o, e)
	(o, e) = f(0, n)
	if o:
		return 'Yes'
	return 'No'
print(main())


N = int(input())
A = [int(x) for x in input().split()]
dp = [[False] * (N + 1) for _ in range(N + 1)]
dp[0][0] = True
for i in range(N):
	if A[i] % 2 == 1:
		for j in range(N):
			for k in range(i + 1):
				if (k - i + 1) % 2 == 1 and A[k] % 2 == 1 and dp[k][j]:
					dp[i + 1][j + 1] = True
print('Yes' if any((dp[-1][i] for i in range(1, N + 1, 2))) else 'No')


n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0:
	print('No')
	return
if a[0] * a[-1] % 2 == 0:
	print('No')
	return
print('Yes')


from collections import defaultdict, deque, Counter
from heapq import heapify, heappop, heappush
import math
from copy import deepcopy
from itertools import combinations, permutations, product
from bisect import bisect_left, bisect_right
import sys

def input():
	return sys.stdin.readline().rstrip()

def getN():
	return int(input())

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

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

def getArray(intn):
	return [int(input()) for i in range(intn)]
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7
MOD = 998244353
INF = float('inf')
eps = 10 ** (-10)
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
N = getN()
A = getList()
dp = [set() for i in range(N + 1)]
dp[0].add(0)
for i in range(N):
	if A[i] % 2 == 0:
		continue
	for j in range(i, N):
		for o in list(dp[i]):
			if A[j] % 2 == 1 and (j - i) % 2 == 0:
				dp[j + 1].add(o + 1)
for o in list(dp[N]):
	if o % 2 == 1:
		print('Yes')
		exit()
print('No')


input()
an = list(map(int, input().split()))
if not an[0] % 2 or not an[-1] % 2 or (not len(an) % 2):
	print('no')
else:
	print('yes')


import sys

def odd(numb):
	if numb % 2 == 0:
		return False
	else:
		return True
n = input()
n = int(n)
a = list(map(int, input().split()))
if not (odd(a[0]) and odd(a[n - 1])):
	print('NO')
	sys.exit()
elif odd(len(a)):
	print('YES')
	sys.exit()
for i in range(n - 1):
	if odd(a[i]) and odd(a[i + 1]):
		if odd(len(a[0:i])) and odd(len(a[i + 1:n])):
			print('YES')
			sys.exit()
print('NO')
sys.exit()


n = int(input())
array = input().split()
if n % 2 == 1 and int(array[0]) % 2 == 1 and (int(array[n - 1]) % 2 == 1):
	print('Yes')
else:
	print('No')


n = int(input())
arr = list(map(int, input().split(' ')))
if len(arr) % 2 and arr[0] % 2 and arr[-1] % 2:
	print('YES')
else:
	print('NO')


n = int(input())
arr = input().split(' ')
if n % 2 == 0:
	print('No')
elif int(arr[0]) % 2 == 1 and int(arr[n - 1]) % 2 == 1:
	print('Yes')
else:
	print('No')


get = lambda cast: [cast(x) for x in input().split()]
_ = input()
seq = get(int)
seg = 0
odd = lambda x: x % 2 == 1

def no():
	print('No')
	exit(0)

def yes():
	print('Yes')
	exit(0)
if not odd(seq[0]) or not odd(seq[-1]) or (not odd(len(seq))):
	no()
yes()


get = lambda : list(map(int, input().split()))
n = int(input())
l = get()
if l[0] % 2 == 0 or l[n - 1] % 2 == 0:
	print('No')
	exit()
if n % 2 and l[n - 1] % 2:
	print('Yes')
	exit()
r = 0
ans = []
for i in l:
	if i % 2:
		ans.append(i)
		r += 1
now = 0
j = 0
for i in ans:
	if (i - now) % 2 == 0:
		now = i
		j += 1
print('Yes' if j % 2 else 'No')


n = int(input())
l = list(map(int, input().split()))
a = ''
flag = 1
if n % 2 == 0:
	print('No')
	exit()
else:
	for i in l:
		if i % 2 == 0:
			a = a + '0'
		else:
			a = a + '1'
if a[0] != '1' or a[-1] != '1':
	flag = 0
if flag == 0:
	print('No')
else:
	print('Yes')


length = int(input())
numbers = [int(a) for a in input().strip().split()]
if length % 2 == 0:
	print('No')
elif numbers[0] % 2 == 0 or numbers[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
src = input()
a = list(map(int, src.split()))
if a[0] % 2 == 0 or a[n - 1] % 2 == 0 or n % 2 == 0:
	print('NO')
else:
	print('YES')


n = int(input())
L = list(map(int, input().split()))
if n % 2 == 0:
	print('No')
elif L[0] % 2 == 1 and L[len(L) - 1] % 2 == 1:
	print('Yes')
else:
	print('No')


n = int(input())
A = list(map(int, input().split()))
print(('NO', 'YES')[A[0] * A[-1] * n % 2])


n = int(input())
a = (*map(int, input().split()),)
print('NYOE S'[a[0] % 2 * (a[-1] % 2) * (n % 2)::2])


n = int(input())
data = list(map(int, input().split()))
d = []
if n % 2 == 0 or data[0] % 2 == 0 or data[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


a = int(input())
b = list(map(int, input().split(' ')))
ans = 'Yes' if a % 2 and b[0] % 2 and b[-1] % 2 else 'No'
print(ans)


n = int(input())
l = list(map(int, input().split()))
if n % 2 != 0:
	if l[0] % 2 != 0 and l[n - 1] % 2 != 0:
		print('Yes')
	else:
		print('No')
elif n % 2 == 0:
	if l[0] % 2 != 0 and l[n - 1] % 2 != 0:
		print('No')
	elif l[0] % 2 != 0 or l[n - 1] % 2 != 0:
		print('No')
	else:
		print('No')


leng = input()
arr = input()
leng = int(leng)
arr = list(map(int, arr.split(' ')))
if leng % 2 == 0:
	print('No')
elif arr[0] % 2 == 0 or arr[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


from typing import List

def solve(n: int, arr: List[int]) -> str:
	if n % 2 == 0 or arr[0] % 2 == 0 or arr[-1] % 2 == 0:
		return 'No'
	return 'Yes'
n = int(input())
arr = list(map(int, input().split()))
print(solve(n, arr))


def is_odd(n):
	return n % 2 == 1

def main():
	n = int(input())
	ls = [int(i) for i in input().split()]
	answer = 'Yes' if is_odd(n) and is_odd(ls[0]) and is_odd(ls[-1]) else 'No'
	print(answer)
main()


n = int(input())
a = [i for i in map(int, input().split())]
if a[0] % 2 + a[n - 1] % 2 + n % 2 == 3:
	print('Yes')
else:
	print('No')


n = int(input())
arreglo = list(map(int, input().split()))
if n % 2 == 0 or arreglo[0] % 2 == 0 or arreglo[-1] % 2 == 0:
	print('NO')
else:
	print('YES')


(n, a) = (int(input()), list(map(int, input().split())))
dp = [[0] * 2 for _ in range(n)]
if a[0] % 2 == 1:
	dp[0][0] = 1
for i in range(1, n):
	if a[i] % 2 == 0:
		continue
	for j in range(i):
		if a[j] % 2 == 1 and (i - j + 1) % 2 == 1:
			if j == 0:
				dp[i][1] = dp[i][1] or 0
				dp[i][0] = dp[i][0] or 1
			else:
				dp[i][1] = dp[i][1] or dp[j - 1][0]
				dp[i][0] = dp[i][0] or dp[j - 1][1]
if dp[n - 1][0]:
	print('Yes')
else:
	print('No')


n = int(input())
l = []
i = input()
l = i.split()
c = 0
if len(l) % 2 != 0:
	if int(l[0]) % 2 != 0 and int(l[len(l) - 1]) % 2 != 0:
		print('Yes')
	else:
		print('No')
else:
	print('No')


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

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

def strmulti():
	return map(str, inp().split())

def lis():
	return list(map(int, inp().split()))

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

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def stringlis():
	return list(map(str, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	print(' '.join((str(a[i]) for i in range(len(a)))))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
n = int(input())
a = lis()
if n % 2 != 0 and a[0] % 2 != 0 and (a[-1] % 2 != 0):
	print('YES')
else:
	print('NO')


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


import sys
n = int(input())
num = list(map(int, input().split()))
if n & 1 and num[0] & 1 and num[n - 1] & 1:
	print('Yes')
else:
	print('No')


(_, nums) = (input(), [int(x) for x in input().split()])

def is_odd(num):
	return num % 2 != 0
from pdb import set_trace
group_len = 0
group_counter = 0
summ = 0
if not is_odd(nums[-1]) or not is_odd(nums[0]):
	print('No')
	exit()
for x in range(len(nums)):
	group_len += 1
	if is_odd(nums[x]):
		if len(nums) - 1 != x:
			if not is_odd(nums[x + 1]):
				continue
		if is_odd(group_len):
			group_counter += 1
			summ += group_len
			group_len = 0
summ += group_len
if summ == len(nums) and is_odd(group_counter):
	print('Yes')
else:
	print('No')


from sys import stdin
n = int(input())
a = []
a = input().split()
a = [int(x) for x in a]
if n % 2 and a[0] % 2 and a[-1] % 2:
	print('Yes')
else:
	print('No')


n = int(input())
if n % 2 == 0:
	print('No')
	exit()
arr = list(map(int, input().split()))
if arr[0] % 2 == 1 and arr[-1] % 2 == 1:
	print('Yes')
else:
	print('No')


def is_correct(arr):
	arr_len = len(arr)
	if arr_len == 0 or arr_len % 2 == 0 or check_border(arr):
		return False
	return True

def check_border(arr):
	return arr[0] % 2 == 0 or arr[-1] % 2 == 0

def do_magic(arr):
	k = 1
	while k < len(arr):
		parts = []
		(start, end) = (0, k)
		while start < len(arr):
			if end > len(arr):
				part = arr[start:-1]
			else:
				part = arr[start:end]
			if not is_correct(part):
				break
			parts.append([part])
			start = end + 1
			end += k
			parts.append([part])
		if len(parts) % 2 != 0:
			print('Yes')
			return
		k += 2
	print('No')
length = input()
length = int(length)
array = input()
array = [int(i) for i in array.split()]
if is_correct(array):
	print('Yes')
else:
	do_magic(array)


n = 0
arr = []

def check1(i, j):
	return not (arr[i] % 2 == 0 or arr[j - 1] % 2 == 0)

def check2(i, j):
	for k in range(i + 1, j, 2):
		if check1(i, k) and check1(k, j):
			return True
	for k in range(i + 2, j - 1, 2):
		if check2(i, k) and check2(k, j):
			return True
	return False

def main():
	global n
	global arr
	n = int(input())
	arr = list(map(int, input().split(' ')))
	if n % 2 == 0:
		return False
	return check1(0, n)
if main():
	print('Yes')
else:
	print('No')


length = int(input())
arr = [*map(int, input().split())]
if length % 2 == 0 or arr[0] % 2 == 0 or arr[length - 1] % 2 == 0:
	print('No')
else:
	print('Yes')


a = int(input())
b = input().split(' ')
listas = list(map(int, b))
if a % 2 == 0 or listas[0] % 2 == 0 or listas[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input().strip())
nums = list(map(int, input().strip().split()))
if n % 2 == 1 and nums[0] % 2 == 1 and (nums[-1] % 2 == 1):
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
res = 'Yes'
if n % 2 == 0:
	res = 'No'
if a[0] % 2 == 0 or a[-1] % 2 == 0:
	res = 'No'
print(res)


n = int(input())
a = [int(s) for s in input().split()]
count = 0
if n % 2 == 0 or a[0] % 2 == 0 or a[n - 1] % 2 == 0:
	print('No')
else:
	print('YES')


input()
seq = [int(i) for i in input().split()]
print('No' if len(seq) % 2 == 0 or seq[0] % 2 == 0 or seq[-1] % 2 == 0 else 'Yes')


n = int(input())
m = list(map(int, input().split()))
if m[0] & 1 and (m[n - 1] & 1 and n & 1):
	print('Yes')
else:
	print('No')


input()
arr = input().split()
if len(arr) % 2 == 0 or int(arr[0]) % 2 == 0 or int(arr[len(arr) - 1]) % 2 == 0:
	print('NO')
else:
	print('YES')


n = int(input())
As = list(map(int, input().split()))
if n % 2 == 0:
	print('NO')
elif As[0] % 2 == 0 or As[-1] % 2 == 0:
	print('NO')
else:
	print('YES')


values_nr = int(input())
idx___value = [int(x) for x in input().split()]
if len(idx___value) % 2 != 0 and idx___value[0] % 2 != 0 and (idx___value[-1] % 2 != 0):
	print('Yes')
else:
	print('No')


def main(lst):
	start = len(lst) - 1
	end = len(lst) - 1
	subsegs = 0
	if lst[0] % 2 == 0 or lst[len(lst) - 1] % 2 == 0:
		return 'NO'
	if len(lst) % 2 != 0:
		return 'YES'
	while len(lst) != 0:
		sub = lst[start:end + 1]
		if sub[0] % 2 == 0:
			start -= 1
		elif len(sub) % 2 == 0:
			start -= 1
		else:
			del lst[start:end + 1]
			start = len(lst) - 1
			end = len(lst) - 1
			subsegs += 1
		if start < 0:
			return 'NO'
	if subsegs % 2 != 0:
		return 'YES'
	else:
		return 'NO'
input()
lst = input().split()
lst = [eval(i) for i in lst]
print(main(lst))


from sys import stdin
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
if n % 2 != 0 and (a[0] % 2 != 0 and a[-1] % 2 != 0):
	print('Yes')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
dp = [[0] * (n + 1) for i in range(n + 1)]
dp[0][0] = 1
for k in range(1, n + 1):
	for i in range(1, n + 1):
		for j in range(0, i):
			if (i - j) % 2 == 1 and a[j] % 2 == 1 and (a[i - 1] % 2 == 1) and (dp[k - 1][j] == 1):
				dp[k][i] = 1
for k in range(1, n + 1):
	if k % 2 == 1 and dp[k][n] == 1:
		print('yes')
		exit(0)
print('no')


n = int(input())
a = [int(q) for q in input().strip().split()]
if int(n) % 2 == 0 or int(a[0]) % 2 == 0 or int(a[n - 1]) % 2 == 0:
	print('No')
else:
	print('Yes')


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations
from math import gcd, floor, inf
from bisect import bisect_right, bisect_left
num = int(input())
arr = list(map(int, input().split()))
if num % 2 and arr[0] % 2 and arr[-1] % 2:
	print('YES')
else:
	print('NO')


a = int(input())
b = list(map(int, input().split()))
print('NYoe s'[a & 1 == b[0] & 1 == b[-1] & 1 == 1::2])


n = int(input())
a = list(map(int, input().split()))
print('YNeos'[not n & a[0] & a[-1] & 1::2])


import sys
n = int(input())
a = list(map(int, input().split()))
if n % 2 and a[0] % 2 and a[-1] % 2:
	print('YES')
else:
	print('NO')


n = int(input())
arr = input()

def problem5(n, arr):
	arr = arr.split()
	size = len(arr)
	if int(arr[0]) % 2 == 0 or int(arr[size - 1]) % 2 == 0 or size % 2 == 0:
		return 'NO'
	else:
		return 'YES'
print(problem5(n, arr))


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


import sys
n = int(input())
a = list(map(int, input().split()))
if len(a) % 2 == 1 and a[0] % 2 == 1 and (a[n - 1] % 2 == 1):
	print('Yes')
else:
	print('No')


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

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

def map_string():
	return input().split()
n = int(input())
a = list_input()
if a[0] % 2 and a[-1] % 2 and n % 2:
	print('Yes')
else:
	print('No')


n = int(input())
x = list(map(int, input().split()))
if n == 1 and x[0] % 2 != 0:
	print('Yes')
	exit()
if x[0] % 2 == 0 or x[-1] % 2 == 0 or n % 2 == 0:
	print('No')
	exit()
if x[0] % 2 != 0 and x[-1] % 2 != 0:
	print('Yes')
	exit()
a = 0
flag = 0
ans = 0
for i in range(n):
	if i == n - 1 and x[i - 1] % 2 != 0:
		ans += 1
	if flag == 1:
		a += 1
		if x[i] % 2 != 0:
			if i != n - 1:
				if x[i + 1] % 2 == 0:
					continue
			if a % 2 != 0:
				ans += 1
				flag = 0
				a = 0
	elif flag == 0:
		if i != n - 1 and x[i + 1] % 2 != 0:
			ans += 1
		flag = 1
		a = 1
if ans % 2 == 0:
	print('No')
else:
	print('Yes')


from math import gcd, ceil
from collections import defaultdict as dd

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

def inin():
	return int(input())

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

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su
n = inin()
arr = inar()
if n % 2 == 1 and arr[0] % 2 == 1 and (arr[-1] % 2 == 1):
	print('Yes')
else:
	print('No')


nVals = int(input())
vals = [int(x) for x in input().split()]
if len(vals) % 2 == 0:
	print('NO')
elif vals[0] % 2 == 1 and vals[-1] % 2 == 1:
	print('Yes')
else:
	print('NO')


IL = lambda : list(map(int, input().split()))
I = lambda : int(input())
n = I()
a = [i % 2 for i in IL()]
ans = a[0] == a[-1] == 1
parity = 0
count = 0
for (i, el) in enumerate(a):
	parity += 1
	if el and parity % 2 and (i == n - 1 or a[i + 1]):
		count += 1
		parity = 0
if parity % 2:
	ans = False
ans = ans and count % 2
print('Yes' if ans else 'No')


numOfnum = int(input())
list = [int(x) for x in input().split()]
if list[0] % 2 == 0 or list[-1] % 2 == 0 or numOfnum % 2 == 0:
	print('No')
else:
	print('Yes')


def oddsEnds(sequence, n):
	if sequence[0] % 2 == 0 or sequence[n - 1] % 2 == 0 or n % 2 == 0:
		print('NO')
	else:
		print('YES')
n = int(input())
sequence = [int(x) for x in input().split()]
oddsEnds(sequence, n)


n = int(input().strip())
l = [int(i) for i in input().split()]
if n % 2 == 0:
	print('NO')
elif l[0] & 1 == 0 or l[-1] & 1 == 0:
	print('NO')
else:
	print('YES')


n = int(input())
a = input().split()
if int(a[0]) % 2 == 1 and int(a[-1]) % 2 == 1 and (len(a) % 2 == 1):
	print('Yes')
else:
	print('No')


N = int(input())
A = []
A = input().split()
for i in range(N):
	A[i] = int(A[i])
if A[0] % 2 == 1 and A[N - 1] % 2 == 1 and (N % 2 != 0):
	print('YES')
else:
	print('NO')


n = int(input())
arr = list(map(int, input().split()))
if len(arr) & 1 == 1 and arr[0] & 1 == 1 and (arr[n - 1] & 1 == 1):
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
if len(a) % 2 == 0:
	print('no')
elif len(a) % 2 == 1:
	if a[0] % 2 == 1 and a[-1] % 2 == 1:
		print('yes')
	else:
		print('no')


while True:
	try:
		n = int(input())
		array = input().split()
		array = [int(ch) for ch in array]
		if len(array) != n:
			ValueError
		break
	except ValueError:
		pass
if n % 2 == 0:
	print('No')
elif array[0] % 2 == 0 or array[n - 1] % 2 == 0:
	print('No')
else:
	print('Yes')


(N, X) = (int(input()), list(map(int, input().split())))
Even = len(list(filter(lambda x: x % 2 == 0, X)))
if X[0] % 2 == 0 or X[-1] % 2 == 0:
	print('NO')
	exit()
if N % 2 == 1:
	print('YES')
	exit()
print('NO' if (N - Even) % 2 == Even % 2 else 'YES')


import sys
n = int(input())
mass = input().split()
mass = [int(a) for a in mass]
first = mass[0]
last = mass[n - 1]
if first % 2 != 1 or last % 2 != 1:
	print('NO')
	sys.exit()
if first % 2 == 1 and last % 2 == 1 and (n % 2 == 1):
	print('YES')
	sys.exit()
count_of_elements = 0
count_of_arrays = 0
for i in range(0, n):
	count_of_elements = count_of_elements + 1
	if i == n - 1:
		if count_of_elements == 1:
			count_of_arrays = count_of_arrays + 1
		elif count_of_elements % 2 == 1:
			count_of_arrays = count_of_arrays + 1
			continue
		else:
			print('NO')
			sys.exit()
	elif count_of_elements % 2 == 1 and mass[i + 1] % 2 == 1 and (mass[i] % 2 == 1):
		count_of_arrays = count_of_arrays + 1
		count_of_elements = 0
		continue
if count_of_arrays % 2 == 0:
	print('NO')
else:
	print('YES')


import sys
list_num = list(map(int, sys.stdin.read().split()))
size = list_num[0]
nums = list_num[1:]
if size % 2 == 0 or nums[0] % 2 == 0 or nums[size - 1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
a = [int(x) for x in input().split(' ')]
if n % 2 == 1 and a[0] % 2 == 1 and (a[-1] % 2 == 1):
	print('Yes')
else:
	print('No')


n = int(input())
a = list(map(int, input().split()))
if a[0] % 2 == 0 or a[-1] % 2 == 0:
	print('No')
	exit()
(i, count) = (0, 0)
while i < len(a):
	if a[i] % 2:
		count += 1
	else:
		(countEven, j) = (1, i + 1)
		while j < len(a) and a[j] % 2 == 0:
			countEven += 1
			j += 1
		i = j
		if countEven % 2 == 0:
			count += 1
	i += 1
print('Yes') if count % 2 else print('No')


def odd(x):
	return x % 2 == 1
n = int(input())
a = tuple(map(int, input().split(' ')))
assert len(a) == n
print('Yes' if odd(n) and odd(a[0]) and odd(a[n - 1]) else 'No')


n = int(input())
l = list(map(int, input().split()))
k = -1
if l[0] % 2 == 0 or l[-1] % 2 == 0:
	k = 0
elif n % 2 == 1:
	k = 1
else:
	k = 0
print('YES' if k == 1 else 'NO')


input1 = int(input())
input2 = input()
numArr = [int(i) for i in input2.split()]
if len(numArr) == input1:
	if numArr[0] % 2 == 1 and numArr[len(numArr) - 1] % 2 == 1:
		if len(numArr) % 2 == 1:
			print('Yes')
		else:
			print('No')
	else:
		print('No')


n = int(input())
a = [int(i) for i in input().split()]
if n % 2 == 0 or a[0] % 2 == 0 or a[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
x = [int(q) for q in input().split()]
if n & 1 == 0:
	print('NO')
elif x[0] & 1 == 1 and x[-1] & 1 == 1:
	print('YES')
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
if a[0] % 2 == 0 or a[-1] % 2 == 0:
	print('NO')
elif n % 2 == 1:
	print('YES')
else:
	l = []
	for i in range(n):
		if a[i] % 2 == 0:
			l.append(i)
	i = 0
	p = []
	while i < len(l):
		t = []
		k = l[i]
		while i < len(l) and l[i] - k <= 2:
			t.append(l[i])
			k = l[i]
			i += 1
		if len(t) > 0:
			v = [t[0] - 1, t[-1] + 1]
			p.append(v)
	q = 0
	i = 0
	arr = []
	while i < n:
		if q < len(p) and p[q][0] == i:
			arr.append(a[p[q][0]:p[q][1] + 1])
			i += len(a[p[q][0]:p[q][1] + 1])
			q += 1
		else:
			arr.append([a[i]])
			i += 1
	y = True
	i = 0
	while i < len(arr):
		if len(arr[i]) % 2 == 0:
			if i - 1 >= 0:
				arr[i - 1:i + 1] = [arr[i - 1] + arr[i]]
				i -= 1
			elif i + 1 < len(arr) and len(arr[i + 1]) % 2 > 0:
				arr[i:i + 2] = [arr[i] + arr[i + 1]]
			else:
				y = False
				break
		i += 1
	if len(arr) % 2 == 0:
		y = False
	if y:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = [int(i) for i in input().split()]
flag = True
if arr[0] % 2 == 0 or arr[-1] % 2 == 0:
	flag = False
elif arr[0] % 2 != 0 and arr[-1] % 2 != 0 and (len(arr) % 2 != 0):
	flag = True
else:
	for i in range(n - 1, 0, -1):
		if i % 2 == 0:
			if arr[i] % 2 == 0:
				flag = False
				break
		elif (n - i) % 2 == 0 and flag == False:
			flag = False
			break
if flag == True and n % 2 != 0:
	print('Yes')
else:
	print('No')


n = int(input())
arr = list(map(int, str(input()).split(' ')))

def isOdd(n):
	return int(n) % 2 != 0
if not isOdd(arr[0]) or not isOdd(arr[len(arr) - 1]) or len(arr) % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
seq = list(map(int, input().split()))
if n % 2 != 0 and seq[0] % 2 != 0 and (seq[n - 1] % 2 != 0):
	print('Yes')
	exit()
print('No')


import sys

def main():
	n = int(input())
	s = list(map(int, sys.stdin.readline().split()))
	if n % 2 == 1 and s[0] % 2 == 1 and (s[-1] % 2 == 1):
		print('Yes')
	else:
		print('No')
main()


lectura = lambda : map(int, input().split())
numeroElementos = int(list(lectura())[0])
elementos = list(lectura())
posicion = 0
conclusion = 'No'
if elementos[0] % 2 and elementos[numeroElementos - 1] % 2 and (numeroElementos % 2 == 1):
	conclusion = 'Yes'
print(conclusion)


import sys

def is_odd(x):
	return x % 2 != 0
N = int(input())
A = list(map(int, input().split()))
if not is_odd(A[0]) or not is_odd(A[-1]):
	print('No')
	sys.exit()
(intervals, i, l) = (1, 0, 1)
while i < N - 1:
	if is_odd(A[i]) and is_odd(A[i + 1]) and is_odd(l):
		l = 1
		intervals += 1
	else:
		l += 1
	i += 1
if not is_odd(l):
	intervals -= 1
print('Yes' if is_odd(intervals) else 'No')


n = int(input())
a = list(map(int, input().split()))
flag = False
i = 0
c = 0
while i < n:
	if not a[i] % 2:
		print('No')
		break
	j = i
	last = -1
	while j < n:
		if a[j] % 2 and (i - j + 1) % 2:
			last = j
		j += 1
	if last == -1:
		print('No')
		break
	i = last + 1
	c += 1
else:
	if c % 2:
		print('Yes')
	else:
		print('No')


from math import *
import itertools as it
from collections import *
EPS = 1e-09

def get_int():
	return int(input().strip())

def get_string():
	return input().strip()

def get_array():
	return list(map(int, input().strip().split(' ')))

def print_array(a, glue=' '):
	print(glue.join(map(str, a)))

def print_grid(grid, glue=' '):
	for row in grid:
		print_array(row, glue)

def solve():
	n = get_int()
	a = get_array()
	if a[0] % 2 == 0 or a[-1] % 2 == 0:
		return 'No'
	if n % 2 == 1:
		return 'Yes'
	return 'No'
ntest = 1
for _ in range(ntest):
	print(solve())


n = int(input())
s = [int(j) for j in input().split()]
if len(s) % 2 == 0 or s[0] % 2 == 0 or s[n - 1] % 2 == 0:
	print('NO')
else:
	print('YES')


n = int(input())
l = list(map(int, input().split()))
done = 0
if n % 2 == 0 or l[0] % 2 == 0:
	done = 1
else:
	for j in range(n):
		if j % 2 == 0 and l[j] % 2 == 0:
			done = 1
		else:
			done = 0
if done == 1:
	print('No')
else:
	print('Yes')


a = int(input())
s = [int(x) for x in input().split()]
if a % 2 == 0:
	print('No')
elif s[0] % 2 == 0:
	print('No')
elif s[len(s) - 1] % 2 == 0:
	print('No')
else:
	print('Yes')


def test_1():
	import math
	from collections import Counter
	n = list(map(int, input().split(' ')))[0]
	data = list(map(int, input().split(' ')))
	if n % 2 == 0:
		print('No')
	elif data[0] % 2 == 0 or data[-1] % 2 == 0:
		print('No')
	else:
		print('Yes')
test_1()


n = int(input())
l = list()
s = input()
l = s.split(' ', n - 1)
for i in range(len(l)):
	l[i] = int(l[i])
if (l[0] % 2 == 1) & (l[len(l) - 1] % 2 == 1) & len(l):
	print('Yes')
else:
	print('No')


def check(seq):
	a = len(seq) % 2 == 1
	b = seq[0] % 2 == 1
	c = seq[len(seq) - 1] % 2 == 1
	return a and b and c
length = int(input())
numbers = [int(n) % 2 for n in input().split()]
print('Yes' if check(numbers) else 'No')


n = int(input())
seq = [int(x) % 2 for x in input().split()]

def solve(ss):
	n = len(ss)
	if ss[0] == 1 and ss[n - 1] == 1:
		if n % 2 == 1:
			return 1
		else:
			i = 1
			next_ss = None
			for i in range(1, n - 1, 2):
				if ss[i] == 1:
					next_ss = i
					break
			if next_ss is None:
				return None
			else:
				res = solve(ss[i:])
				if res is None:
					return None
				else:
					return 1 + res
	else:
		return None
cnt = solve(seq)
if cnt is None or cnt % 2 == 0:
	print('NO')
else:
	print('YES')


n = int(input())
list = [int(i) for i in input().split()]
if n % 2 == 0:
	print('No')
elif list[0] % 2 == 0 or list[-1] % 2 == 0:
	print('No')
elif n % 2 == 1 and list[0] % 2 == 1 and (list[-1] % 2 == 1):
	print('Yes')


n = int(input().strip())
l = list(map(int, input().strip().split()))

def check(n, l):
	if n % 2 == 0:
		return 'No'
	elif l[0] % 2 == 0 or l[-1] % 2 == 0:
		return 'No'
	else:
		return 'Yes'
print(check(n, l))


class CodeforcesTask849ASolution:

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

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

	def process_task(self):
		if not self.n % 2:
			self.result = 'No'
		elif self.sequence[0] % 2 == 0:
			self.result = 'No'
		elif self.sequence[-1] % 2 == 0:
			self.result = 'No'
		else:
			self.result = 'Yes'

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


def solve():
	length = int(input())
	seq = input().split(' ')
	if int(seq[0]) % 2 == 0 or int(seq[length - 1]) % 2 == 0 or length % 2 == 0:
		return False
	return True
if solve():
	print('Yes')
else:
	print('No')


from sys import stdin
n = int(stdin.readline().rstrip())
data = list(map(int, stdin.readline().rstrip().split()))
if n % 2 == 0:
	print('NO')
	exit()
if data[0] % 2 == 0 or data[-1] % 2 == 0:
	print('NO')
	exit()
print('YES')


def id(v, n):
	if not v[0] % 2 or not v[-1] % 2:
		return 0
	if n % 2:
		return 1
	else:
		return 0
n = int(input())
v = [int(c) for c in input().split()]
if id(v, n):
	t = 'Yes'
else:
	t = 'No'
print(t)


n = int(input())
x = [*map(int, input().split())]
if n % 2 and x[0] % 2 and x[-1] % 2:
	print('Yes')
else:
	print('No')


length = int(input())
vals = [int(x) for x in input().split(' ')]
if length % 2 == 0 or vals[0] % 2 == 0 or vals[-1] % 2 == 0:
	print('No')
else:
	print('Yes')


n = int(input())
s = list(map(int, input().strip().split(' ')))
if n % 2 == 0:
	print('No')
elif s[0] % 2 == 0 or s[n - 1] % 2 == 0:
	print('No')
else:
	print('Yes')


import sys
Input = sys.stdin.readline
n = int(Input())
a = list(map(int, input().split()))
if n % 2:
	if a[0] % 2:
		if a[-1] % 2:
			print('Yes')
			exit()
print('No')


tam = int(input())
arr = list(map(int, input().split()))
if tam % 2 == 0 or arr[0] % 2 == 0 or arr[tam - 1] % 2 == 0:
	print('NO')
else:
	print('YES')


_ = input()
nums = [int(i) for i in input().split(' ')]
if nums[0] % 2 == 0 or nums[-1] % 2 == 0 or len(nums) % 2 == 0:
	print('No')
else:
	print('Yes')


a = int(input())
f = []
g = 0
x = 0
b = list(map(int, input().split()))
if b[0] % 2 == 0 or b[-1] % 2 == 0 or a % 2 == 0:
	print('No')
else:
	print('Yes')


import math

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


import sys
n = int(sys.stdin.readline())
nums = list(map(int, sys.stdin.readline().split()))

def possible(arr):
	if arr[0] % 2 == 0 or arr[-1] % 2 == 0:
		return False
	if len(arr) % 2 == 1:
		return True
if possible(nums):
	print('Yes')
else:
	print('No')


input_length = int(input())
sequence_string = input()
sequence = []
for i in sequence_string.split(' '):
	sequence.append(int(i))
isRight = False
if input_length % 2 == 1:
	if sequence[0] % 2 == 1 and sequence[-1] % 2 == 1:
		isRight = True
if isRight:
	print('Yes')
else:
	print('No')


n = int(input())
seq = [int(i) for i in input().split()]
lasts = []
q = 0
cnt = 0
if n % 2 == 0 or seq[0] % 2 == 0 or seq[n - 1] % 2 == 0:
	print('No')
else:
	for i in range(n):
		el = seq[i]
		if i < n - 1:
			if el % 2 == 1 and i % 2 == q and (seq[i + 1] % 2 == 1):
				cnt += 1
				q = (q + 1) % 2
		elif i % 2 == q:
			cnt += 1
	if cnt % 2 == 1:
		print('Yes')
	else:
		print('No')


input()
a = input().split()
if len(a) % 2 == 0:
	print('No')
	quit()
if not (int(a[0]) % 2 == 0 or int(a[-1]) % 2 == 0):
	print('Yes')
	quit()
print('No')


n = int(input())
n_list = list(map(int, input().split()))
first = n_list[0]
last = n_list[-1]
if n % 2 != 0:
	if first % 2 != 0 and last % 2 != 0:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


import math
import collections
import bisect
import heapq
import time
import random
import itertools
N = int(input())
A = [int(x) for x in input().split()]
if N % 2 == 0:
	print('No')
elif A[0] % 2 != 0 and A[-1] % 2 != 0:
	print('Yes')
else:
	print('No')