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

Starter code:

Solutions:
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):
	print('No')
else:
	if(arr[0] % 2 == 1 and arr[-1] % 2 == 1):
		print('Yes')
	else:
		print('No')

n = int(input())
a = list(map(int, input().split()))
if a[0] % 2 == 1 and a[n - 1] % 2 == 1 and n % 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())
a = list(map(int, input().split()))
if len(a) % 2 == 1:
    if a[0] % 2  == 1 and a[n - 1] % 2 == 1:
        print('Yes')
    else:
        print('No')
else:
    print('No')


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

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

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


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

if n % 2 == 0:
    print('No')
elif a[0] % 2 == 0 or a[-1] % 2 == 0:
    print('No')
else:
    print('Yes')

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

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

if ls[0] % 2 == 1 and ls[-1] % 2 == 1 and len(ls) % 2 == 1:
    print('Yes')
else:
    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()


n = int(input())
a = list(map(int, input().split()))
if n%2==1:
    if (a[0]%2==1) and (a[n-1]%2==1):
        print("Yes")
    else:
        print("No")
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')


from math import *
import itertools as it
from collections import *

EPS = 1e-9
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
# ntest = get_int()
for _ in range(ntest):
    print(solve())


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

if A[0] % 2 == 0 or A[-1] % 2 == 0 or len(A) % 2 == 0:
  print('No')
else:
  print('Yes')



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

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

if (n & 1) and (a[0] & 1) and (a[-1] & 1):
	print("Yes")
else:
	print("No")


3


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


def __starting_point(): main()

__starting_point()

# coding: utf-8

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

    if n % 2 == 1 and a[0] % 2 == 1 and a[-1] % 2 == 1:
        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")