import numpy as np

from itertools import product



n = int(eval(input()))

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



a = np.array(a)



li = [-1,0,1]

cnt = 0

for v in product(li,repeat = n):

    v = np.array(v)

    L =a+v

    cum = L.cumprod()

    if cum[-1]%2 ==0 :

        cnt +=1

print(cnt)

        
n = int(eval(input()))

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



from itertools import product



li = [-1,0,1]

cnt = 0

for v in product(li,repeat = n):

    L = []

    for i in range(n):

        L.append(v[i]+a[i])

    if any(x%2==0 for x in L):

        cnt +=1



print(cnt)
import numpy as np
from itertools import product

n = int(eval(input()))
a = list(map(int, input().split()))
a = np.array(a)
li = [-1, 0, 1]
cnt = 0
for v in product(li, repeat=n):
    v = np.array(v)
    L = a + v
    cum = L.cumprod()
    if cum[-1] % 2 == 0:
        cnt += 1
print(cnt)

n = int(eval(input()))
a = list(map(int, input().split()))
from itertools import product

li = [-1, 0, 1]
cnt = 0
for v in product(li, repeat=n):
    L = []
    for i in range(n):
        L.append(v[i] + a[i])
    if any(x % 2 == 0 for x in L):
        cnt += 1
print(cnt)

-import numpy as np +n = int(eval(input())) +a = list(map(int, input().split())) -n = int(eval(input())) -a = list(map(int, input().split())) -a = np.array(a) -    v = np.array(v) -    L = a + v -    cum = L.cumprod() -    if cum[-1] % 2 == 0: +    L = [] +    for i in range(n): +        L.append(v[i] + a[i]) +    if any(x % 2 == 0 for x in L):