#include<iostream>
#include<cstdio>
using namespace std;
int n,ans,del,x;
int main() {
	scanf("%d",&n);
	ans=1; del=1;
	for (int i=1;i<=n;i++) {
		scanf("%d",&x);
		ans*=3;
		if (x%2==0) del*=2;
	}
	printf("%d\n",ans-del);
	return 0;
}