#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<ll>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=42;
char A[N][N];
ll dp1[N][N][N][N],dp2[N][N][N][N];
ll sol2(int a,int b,int c,int d);
ll sol1(int a,int b,int c,int d){
	if(dp1[a][b][c][d]!=-1)return dp1[a][b][c][d];
	ll ans=0;
	For(i,a,b)For(j,c,d)if(A[i][j]){
		ans+=sol2(a,i-1,i+1,b)*sol2(c,j-1,j+1,d);
	}
	return dp1[a][b][c][d]=ans;
}
ll sol2(int a,int b,int c,int d){
	if(a>b&&c>d)return 1;
	if(dp2[a][b][c][d]!=-1)return dp2[a][b][c][d];
	ll ans=0;
	For(i,a,b)For(j,c,d){
		ans+=sol1(a,i,j,d)*sol2(i+1,b,c,j-1);
	}
	return dp2[a][b][c][d]=ans;
}
int main(){
	memset(dp1,-1,sizeof(dp1)); memset(dp2,-1,sizeof(dp2));
	int n=read()*2;
	For(i,1,n)scanf("%s",A[i]+1);
	For(i,1,n)For(j,1,n)A[i][j]-='0';
	//For(i,1,n){For(j,1,n)wri(A[i][j]); puts("");}
	ll ans=0;
	For(i,2,n)if(A[1][i])ans+=sol2(2,i-1,i+1,n);
	cout<<ans<<endl;
}