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

int main(){
	ios_base::sync_with_stdio(0);
	int n;
	cin>>n;
	int a[n];
	long long tot=1,x=1;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		if(a[i]%2==0) x*=2;
		tot*=3;
	}
	cout<<tot-x<<endl;
	return 0;	
}