#include<bits/stdc++.h>
using namespace std;
int n,a[20],tot,mis;
int main(){
	scanf("%d",&n);
	int xb;
	tot=1;
	mis=1;
	for(xb=0;xb<n;++xb){
		scanf("%d",a+xb);
		tot*=3;
		if(~a[xb]&1){
			mis*=2;
		}
	}
	printf("%d",tot-mis);
	return 0;
}