#include<iostream>
#include<cstdio>
#define LL long long
using namespace std;
int n;
LL ans;
const int N=45;
char s[N][N];
LL f[N][N][N],g[N][N][N];
int main()
{
	cin>>n;n*=2;
	for(int i=1;i<=n;++i)scanf("%s",s[i]+1);
	for(int i=1;i<n;++i)
	{
		f[i][i][i]=1;
		for(int j=i+1;j<=n;++j)
			if(s[i][j]=='1')g[i][i][j]=1;
	}
	for(int len=3;len<n;len+=2)
		for(int j=1;j+len<=n;++j)
		{
			int k=j+len-1;
			for(int l=j;l<=k;l+=2)
				for(int r=k;r>l;r-=2)
				{
					LL s=0;
					for(int t=r;t<=k;++t)s+=g[j][l][t]*f[r][k][t];
					for(int t=l+1;t<r;++t)f[j][k][t]+=f[l+1][r-1][t]*s;
				}
			for(int t1=j+1;t1<k;++t1)
				for(int t2=k+1;t2<n;++t2)
					if(s[t1][t2]=='1')g[j][k][t2]+=f[j][k][t1];
		}
	for(int i=1;i<n;++i)
		if(s[i][n]=='1')ans+=f[1][n-1][i];
	cout<<ans;
	return 0;
}