#include <iostream>
#include <vector>
using namespace std;

int main(){
	int n;
	cin >> n;
	long long int call=1,codd=1;
	for(int i=0; i<n; i++){
		int num;
		cin >> num;
		if(num%2==0){
			codd*=2;
		}
		call*=3;
	}
	cout << call-codd << endl;
	return 0;
}