#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=45;
int n;
int A[N][N];
LL f[N][N][N][N],g[N][N][N][N];
LL G(int a,int b,int c,int d);
LL F(int a,int b,int c,int d){
	LL &res=f[a][b][c][d];
	if (res!=-1)
		return res;
	if (a>b&&c>d)
		return res=1;
	if ((a>b)^(c>d))
		return res=0;
	res=0;
	For(i,a,b)
		Fod(j,d,c)
			res+=G(a,i,j,d)*F(i+1,b,c,j-1);
	return res;
}
LL G(int a,int b,int c,int d){
	LL &res=g[a][b][c][d];
	if (res!=-1)
		return res;
	if (a>b||c>d)
		return res=0;
	res=0;
	For(i,a,b)
		Fod(j,d,c)
			if (A[i][j])
				res+=F(a,i-1,i+1,b)*F(c,j-1,j+1,d);
	return res;
}
int main(){
	n=read()*2;
	For(i,1,n)
		For(j,1,n)
			scanf("%1d",&A[i][j]);
	memset(f,-1,sizeof f);
	memset(g,-1,sizeof g);
	LL ans=0;
	For(i,2,n)
		if (A[1][i])
			ans+=F(2,i-1,i+1,n);
	cout<<ans<<endl;
	return 0;
}