output_description: Print the number of integer sequences that satisfy the condition.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 ... A_N
attempt: #ifndef LOCAL
  #pragma GCC optimize("O3")
  #include <bits/stdc++.h>
  #else
  #include <iostream>
  #include <iomanip> 
  #include <sstream>
  #include <cstdio>
  #include <cstdlib>
  #include <cmath>
  #include <memory>
  #include <cctype>
  #include <cstring>
  #include <vector>
  #include <list>
  #include <queue>
  #include <deque>
  #include <stack>
  #include <map>
  #include <set>
  #include <algorithm>
  #include <numeric>
  #include <unordered_map>
  #include <unordered_set>
  #endif
  using namespace std;
  #define sim template < class c
  #define ris return * this
  #define dor > debug & operator <<
  #define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
  sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
  struct debug {
  #ifdef LOCAL
  ~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
  #else
  sim dor(const c&) { ris; }
  #endif
  };
  #define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
  
  // #include <ext/pb_ds/assoc_container.hpp> 
  // #include <ext/pb_ds/tree_policy.hpp> 
  // using namespace __gnu_pbds; 
  // #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
  
  template<typename T> void setmax(T& x, T y) {x = max(x, y);}
  template<typename T> void setmin(T& x, T y) {x = min(x, y);}
  #define fix(a) fixed << setprecision(a)
  #define forn(i, n) for (int i = 0; i < int(n); i++)
  #define rep(i, a, b) for (int i = int(a); i < int(b); i++)
  #define all(V) V.begin(), V.end()
  #define rall(V) V.rbegin(), V.rend()
  #define len(V) (int)V.size()
  #define ll long long
  #define ld long double
  #define ff first
  #define ss second
  #define pb push_back
  #define mp make_pair
  #define endl '\n'
  
  
  void solve(){
    int n;
    cin >> n;
    int total = 1;
    int bad = 1;
    forn(i,n){
      int a;
      cin >> a;
      total *= 3;
      if (a%2){
        bad *= 1;
      } else {
        bad *= 2;
      }
    }
    cout << total - bad;
  }
  
  int main() {
    ios::sync_with_stdio(false);
    // cin.tie(0); cout.tie(0);
    int t = 1;
    // cin >> t;
    forn(i, t){
      solve();
    }
  }
  
  /* 
  
  k (k-1) (k-1)
  
  
  
  */
problem_description: Statement
  
  We will say that two integer sequences of length N, x_1, x_2, ..., x_N and
  y_1, y_2, ..., y_N, are _similar_ when |x_i - y_i| \leq 1 holds for all i (1
  \leq i \leq N).
  
  In particular, any integer sequence is similar to itself.
  
  You are given an integer N and an integer sequence of length N, A_1, A_2, ...,
  A_N.
  
  How many integer sequences b_1, b_2, ..., b_N are there such that b_1, b_2,
  ..., b_N is similar to A and the product of all elements, b_1 b_2 ... b_N, is
  even?
samples: [{"input": "2\n    2 3", "output": "7\n    \n\nThere are seven integer sequences that satisfy the condition:\n\n  * 1, 2\n  * 1, 4\n  * 2, 2\n  * 2, 3\n  * 2, 4\n  * 3, 2\n  * 3, 4\n\n* * *"}, {"input": "3\n    3 3 3", "output": "26\n    \n\n* * *"}, {"input": "1\n    100", "output": "1\n    \n\n* * *"}, {"input": "10\n    90 52 56 71 44 8 13 30 57 84", "output": "58921"}]