#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) int(a.size())
const int N=50;

int gi() {
	int x=0,o=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n;
ll f[N][N][N];
char s[N][N];

int main() {
	cin>>n;n<<=1;
	for(int i=1;i<=n;i++) scanf("%s",s[i]+1),f[i][i][i]=1;
	for(int len=3;len<=n;len+=2)
		for(int l=1;l<=n-len+1;l++) {
			int r=l+len-1;
			for(int t=l+1;t<r;t++)
				for(int a=l;a<r;a+=2)
					for(int b=r;b>t;b-=2)
						for(int x=l;x<=a;x++)
							for(int y=b;y<=r;y++)
								if(s[x][y]=='1') f[l][r][t]+=f[l][a][x]*f[b][r][y]*f[a+1][b-1][t];
		}
	ll ans=0;
	for(int i=2;i<=n;i++) if(s[1][i]=='1') ans+=f[2][n][i];
	cout<<ans;
	return 0;
}
