#include<cstdio>
#include<cmath>
int main(){
	register int n,a,o=0;
	scanf("%d",&n);
	for(int i=0;i<n;++i){
		scanf("%d",&a);
		if(a%2==0) o++;
	}
	printf("%d",(int)pow(3,n)-(int)pow(2,o));
	return 0;
}