#include<bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int count=1;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        if(a%2==0) count*=2;
    }
    cout << pow(3,N)-count << endl;
    return 0;
}