void main()
{
    int n = readln.chomp.to!int;
    int[] a = readln.split.to!(int[]);

    int[] odd = new int[n];
    foreach (i, x; a)
    {
        if (x & 1)
        {
            odd[i] = 1;
        }
        else
        {
            odd[i] = 2;
        }
    }

    writeln(3 ^^ n - odd.reduce!((x, y) => x * y));
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;