#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=45;
int n;
char e[N][N];
ll f[N][N][N];
ll g[N][N][N];
int main(){
	scanf("%d",&n); n*=2;
	For(i,1,n) scanf("%s",e[i]+1);
	For(i,1,n) For(j,1,n) e[i][j]-='0';
	For(i,1,n) f[i][i][i]=1;
	For(i,1,n) For(j,1,n) if (e[i][j]) g[i][i][j]=1;
	for (int l=3;l<=n;l+=2)
		for (int i=2,j=l+1;j<=n;i++,j++){
			for (int p1=i;p1<j;p1+=2)
				for (int p2=j;p2>p1;p2-=2){
					ll S=0;
					for (int p3=p2;p3<=j;p3++)
						S+=f[p2][j][p3]*g[i][p1][p3];
					for (int p3=p1+1;p3<p2;p3++)
						f[i][j][p3]+=f[p1+1][p2-1][p3]*S;
				}
			For(k,i,j) For(l,1,n) if (e[k][l])
				g[i][j][l]+=f[i][j][k];
		}
	ll ans=0;
	For(i,2,n) if (e[1][i])
		ans+=f[2][n][i];
	printf("%lld\n",ans);
}