#include<cstdio>
#include<cstring>
#define int long long
int f[50][50][50],n,N,ans;
char s[50][50];
int dp(int l,int r,int mid){
	if(f[l][r][mid]!=-1)return f[l][r][mid];
	if(l==r)return f[l][r][mid]=1;
	if(l==mid||mid==r)return f[l][r][mid]=0;
	int ans=0;
	for(int j=l;j<=mid-1;j++)
		for(int k=mid+1;k<=r;k++)
			if(s[j][k]=='1')
				for(int p=j;p<=mid-1;p++)
					for(int q=mid+1;q<=k;q++)
						ans+=dp(l,p,j)*dp(p+1,q-1,mid)*dp(q,r,k);
	return f[l][r][mid]=ans;
}
signed main(){
	scanf("%lld",&n);
	N=2*n;
	for(int i=1;i<=N;i++)
		scanf("%s",s[i]+1);
	memset(f,-1,sizeof(f));
	for(int i=2;i<=N;i++)
		if(s[1][i]=='1')
			ans+=dp(2,N,i);
	printf("%lld\n",ans);
	return 0;		
}
