#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define N 44
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,G[N][N];
ll dp[N][N][N],ans;
char s[N];
ll dfs(int l,int x,int r){
	if(~dp[l][x][r])return dp[l][x][r];
	if(l==x&&r==x)return dp[l][x][r]=1;
	ll tot=0;
	for(int j=l;j<x;++j){
		for(int k=r;k>x;--k){
			if(!G[j][k])continue;
			for(int p=j;p<x;++p){
				for(int q=k;q>x;--q){
					tot+=dfs(l,j,p)*dfs(p+1,x,q-1)*dfs(q,k,r);
				}
			}
		}
	}
	return dp[l][x][r]=tot;
}
int main(){
	n=read()<<1;
	for(int i=1;i<=n;++i){
		scanf("%s",s+1);
		for(int j=1;j<=n;++j){
			G[i][j]=s[j]-'0';
		}
	}
	memset(dp,-1,sizeof(dp));
	for(int i=2;i<=n;++i){
		if(G[1][i]){
			ans+=dfs(2,i,n);
		}
	}
	printf("%lld\n",ans);
	return 0;
}

