N = int(eval(input()))

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





def dfs(A_s, index,Bss):

    if index == N:

        tmp = 1

        for b in Bss:

            tmp *= b

        return 1 if tmp % 2 == 0 else 0

    b_mi = Bss.copy()

    b_mi.append(A_s[index] - 1)



    b = Bss.copy()

    b.append(A_s[index])



    b_pl = Bss.copy()

    b_pl.append(A_s[index] + 1)

    return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)





print((dfs(As,0,[])))

N = int(eval(input()))

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



tmp = 1

for i in range(N):

    if As[i] % 2 == 0:

       tmp *= 2



print((3 ** N - tmp))
N = int(eval(input()))
As = list(map(int, input().split()))


def dfs(A_s, index, Bss):
    if index == N:
        tmp = 1
        for b in Bss:
            tmp *= b
        return 1 if tmp % 2 == 0 else 0
    b_mi = Bss.copy()
    b_mi.append(A_s[index] - 1)
    b = Bss.copy()
    b.append(A_s[index])
    b_pl = Bss.copy()
    b_pl.append(A_s[index] + 1)
    return (
        dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)
    )


print((dfs(As, 0, [])))

N = int(eval(input()))
As = list(map(int, input().split()))
tmp = 1
for i in range(N):
    if As[i] % 2 == 0:
        tmp *= 2
print((3**N - tmp))

- - -def dfs(A_s, index, Bss): -    if index == N: -        tmp = 1 -        for b in Bss: -            tmp *= b -        return 1 if tmp % 2 == 0 else 0 -    b_mi = Bss.copy() -    b_mi.append(A_s[index] - 1) -    b = Bss.copy() -    b.append(A_s[index]) -    b_pl = Bss.copy() -    b_pl.append(A_s[index] + 1) -    return ( -        dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl) -    ) - - -print((dfs(As, 0, []))) +tmp = 1 +for i in range(N): +    if As[i] % 2 == 0: +        tmp *= 2 +print((3**N - tmp))