"use strict";

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    
    let k = 1;
    
    for(let i in A) {
        if(A[i] % 2 === 0) {
            k *= 2;
        }
    }
    
    console.log(Math.pow(3, N) - k);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
