#include<bits/stdc++.h>
#define ll long long
#define N 55
using namespace std;
ll n,a[N][N],ans,dp[N][N][N];
ll getans(int l,int x,int r){
	if (l==x&&r==x) return 1;
	if (l==x||r==x) return 0;
	if (dp[l][x][r]==0){
		dp[l][x][r]=1;
		for (int i=l;i<x;i++){
			for (int j=i;j<x;j++){
				for (int k=x+1;k<=r;k++){
					for (int s=k;s<=r;s++){
						if (a[i][s])dp[l][x][r]+=getans(l,i,j)*getans(j+1,x,k-1)*getans(k,s,r);
					}
				}
			}
		}
	}
	return dp[l][x][r]-1;
}
int main(){
	cin>>n;
	for (int i=1;i<=n*2;i++){
		for (int j=1;j<=n*2;j++){
			char ch=getchar();
			while (ch!='0'&&ch!='1')ch=getchar();
			a[i][j]=ch-'0';
		}
	}
	for (int j=2;j<=n*2;j++)if (a[1][j]) ans+=getans(2,j,n*2);
	cout<<ans<<endl;
	return 0;
}