#include<iostream>
#include<string.h>
using namespace std;
int ko[1000];
int cun[1000][350];
int ans[1000];
int main()
{
	int length,i,j,sum;
	cin>>length;
	sum=0;
	for(i=0;i<length;i++)
	{
		cin>>ko[i];
		sum=sum+ko[i];
	}
	for(i=0;i<length;i++)
	{
		sum=sum-ko[i];
		if(sum%2==1)
			ko[i]=1-ko[i];
	}
	memset(cun,0,sizeof(cun));
	cun[0][0]=1;
	for(i=1;i<length;i++)
	{
		for(j=0;j<=349;j++)
		{
			cun[i][j]=cun[i-1][j]*2;
		}
		for(j=0;j<=349;j++)
		{
			if(cun[i][j]>10)
			{
				cun[i][j+1]=cun[i][j+1]+cun[i][j]/10;
				cun[i][j]=cun[i][j]%10;
			}
		}
	}
	memset(ans,0,sizeof(ans));
	for(i=0;i<length;i++)
	{
		if(ko[i]==0)
			continue;
		int carry=0;
		for(j=0;j<=349;j++)
		{
			ans[j]=ans[j]+cun[i][j]+carry;
			carry=ans[j]/10;
			ans[j]=ans[j]%10;
		}
	}
	int flag=-1;
	for(i=400;i>=0;i--)
		if(ans[i]!=0)
		{
			flag=i;
			break;
		}
	if(flag==-1)
		cout<<0;
	for(i=flag;i>=0;i--)
		cout<<ans[i];
	cout<<endl;
	return 0;
}