import numpy

import itertools



N = int(eval(input()))

A = [int(i) for i in input().split()]



per = itertools.product([-1,0,1], repeat=N)

ans = 0

for p in per:

  combined = numpy.array([x - y for (x,y) in zip(A,p)])

  product = numpy.prod(combined)

  if product % 2 == 0:

    ans += 1

print(ans)
N = int(eval(input()))

A = [int(i) for i in input().split()]



num_even = 0

for k in A:

  if k % 2 == 0:

    num_even += 1



print((pow(3, N) - pow(2, num_even)))
import numpy
import itertools

N = int(eval(input()))
A = [int(i) for i in input().split()]
per = itertools.product([-1, 0, 1], repeat=N)
ans = 0
for p in per:
    combined = numpy.array([x - y for (x, y) in zip(A, p)])
    product = numpy.prod(combined)
    if product % 2 == 0:
        ans += 1
print(ans)

N = int(eval(input()))
A = [int(i) for i in input().split()]
num_even = 0
for k in A:
    if k % 2 == 0:
        num_even += 1
print((pow(3, N) - pow(2, num_even)))

-import numpy -import itertools - -per = itertools.product([-1, 0, 1], repeat=N) -ans = 0 -for p in per: -    combined = numpy.array([x - y for (x, y) in zip(A, p)]) -    product = numpy.prod(combined) -    if product % 2 == 0: -        ans += 1 -print(ans) +num_even = 0 +for k in A: +    if k % 2 == 0: +        num_even += 1 +print((pow(3, N) - pow(2, num_even)))