import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);

void main()
{
    auto n = lread();
    auto a = aryread();
    long x = 3 ^^ n;
    long y = 1;
    foreach (i; 0 .. n)
    {
        if (a[i] % 2 == 0)
        {
            y *= 2;
        }
    }
    writeln(x - y);

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}
