#include <bits/stdc++.h>
using namespace std;

signed main()
{
	int n;
	cin >> n;
	int a[n];
	int even = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		even += a[i] % 2 == 0 ? 1 : 0;
	}
	cout << (pow(3, n) - pow(2, even)) << endl;
}
