#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=44;
#define MP make_pair
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline int read(){
    int x=0,f=0;char ch=getchar();
    while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
    while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
    return f?-x:x;
}
int n,a[maxn][maxn];
char s[maxn];
ll f[maxn][maxn][maxn],fs[maxn][maxn][maxn],ans;
int main(){
	n=read()*2;
	FOR(i,1,n){
		scanf("%s",s+1);
		FOR(j,1,n) a[i][j]=s[j]-'0';
	}
	if(n==2) return printf("%d\n",a[1][2]),0;
	FOR(i,2,n){
		f[i][i][i]=1;
		FOR(j,2,n) if(a[i][j]) fs[i][j][i]+=f[i][i][i];
	}
	FOR(len,3,n-1) if(len%2==1) FOR(l,2,n-len+1){
		int r=l+len-1;
		FOR(i,l,r) FOR(j,2,n) if(a[i][j]) fs[l][j][r]-=f[l][i][r];
		FOR(p,l,r) FOR(q,p+1,r){
			ll s=0;
			FOR(k,q,r) s+=fs[l][k][p]*f[q][k][r];
			FOR(i,p+1,q-1) f[l][i][r]+=s*f[p+1][i][q-1];
		}
		FOR(i,l,r) FOR(j,2,n) if(a[i][j]) fs[l][j][r]+=f[l][i][r];
	}
	FOR(i,2,n) if(a[1][i]) ans+=f[2][i][n];
	printf("%lld\n",ans);
}
// fk