#include<bits/stdc++.h>
#define ri register int
#define pb push_back
#define fi first
#define se second
using namespace std;
const int rlen=1<<18|1;
char buf[rlen],*ib=buf,*ob=buf;
#define gc() (((ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin)),ib==ob)?-1:*ib++)
typedef long long ll;
typedef pair<int,int> pii;
inline int read(){
	int ans=0;
	char ch=gc();
	while(!isdigit(ch))ch=gc();
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	return ans;
}
typedef long long ll;
inline ll readl(){
	ll ans=0;
	char ch=gc();
	while(!isdigit(ch))ch=gc();
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	return ans;
}
inline int Read(bool*s){
	int top=0;
	char ch=gc();
	while(!isdigit(ch))ch=gc();
	while(isdigit(ch))s[++top]=ch^48,ch=gc();
	return top;
}
const int N=45;
int n;
ll f[N][N][N],res=0;
bool trans[N][N];
ll dfs(int l,int r,int p){
	if(~f[l][r][p])return f[l][r][p];
	if(l==r)return f[l][r][p]=1;
	if(l==p||r==p)return f[l][r][p]=0;
	ll res=0ll;
	for(ri _l=l;_l<p;++_l)for(ri _r=r;_r>p;--_r)if(trans[_l][_r])
	for(ri a=_l;a<p;++a)for(ri b=_r;b>p;--b)res+=dfs(l,a,_l)*dfs(a+1,b-1,p)*dfs(b,r,_r);
	return f[l][r][p]=res;
}
int main(){
	#ifdef ldxcaicai
	freopen("lx.in","r",stdin);
	#endif
	n=read();
	memset(f,-1,sizeof(f));
	for(ri i=1;i<=n*2;++i)Read(trans[i]);
	if(n==1)return cout<<trans[1][2],0;
	for(ri i=3;i<n*2;++i)(trans[1][i])&&(res+=dfs(2,n*2,i));
	cout<<res;
	return 0;
}