#include <bits/stdc++.h>

using namespace std;

int main(){
 int n; 
  cin >>  n;
 
  int res=1,odd=1,a;
  for(int i=0;i<n;i++){
    res*=3;
    cin >> a;
    if(a%2==0) odd*=2; 
    }
  
  cout << res-odd << endl;

}
