#include <iostream>
using namespace std;

int main(void){
  int n;
  cin>>n;
  int sum=1;
  int minus=1;
  int a;
  for(int i=0;i<n;i++){
    cin>>a;
    if(a%2==0) minus=minus*2;
    sum=sum*3;
  }
  cout<<sum-minus<<endl;
  return 0;
}