N = int(eval(input()))

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

ret = 0

for state in range(1 << N):

    flag = False

    ans = 1

    for i in range(N):

        if (state >> i & 1):

            if A[i] % 2 == 1:

                flag = True

            ans *= 2

        else:

            if A[i] % 2 == 0:

                flag = True

    if flag:

        ret += ans

print(ret)

def main() -> None:

    N = int(eval(input()))

    ans = 3 ** N

    odd = 1

    for a in map(int, input().split()):

        if a % 2 == 0:

            odd *= 2

    print((ans - odd))





if __name__ == '__main__':

    main()

N = int(eval(input()))
A = [int(x) for x in input().split()]
ret = 0
for state in range(1 << N):
    flag = False
    ans = 1
    for i in range(N):
        if state >> i & 1:
            if A[i] % 2 == 1:
                flag = True
            ans *= 2
        else:
            if A[i] % 2 == 0:
                flag = True
    if flag:
        ret += ans
print(ret)

def main() -> None:
    N = int(eval(input()))
    ans = 3**N
    odd = 1
    for a in map(int, input().split()):
        if a % 2 == 0:
            odd *= 2
    print((ans - odd))


if __name__ == "__main__":
    main()

-N = int(eval(input())) -A = [int(x) for x in input().split()] -ret = 0 -for state in range(1 << N): -    flag = False -    ans = 1 -    for i in range(N): -        if state >> i & 1: -            if A[i] % 2 == 1: -                flag = True -            ans *= 2 -        else: -            if A[i] % 2 == 0: -                flag = True -    if flag: -        ret += ans -print(ret) +def main() -> None: +    N = int(eval(input())) +    ans = 3**N +    odd = 1 +    for a in map(int, input().split()): +        if a % 2 == 0: +            odd *= 2 +    print((ans - odd)) + + +if __name__ == "__main__": +    main()