#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef double ld;
typedef vi poly;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=41;
ll f[N][N][N],ans;
int a[N][N],n;
char s[N][N];

int main(){
	read(n),n*=2;
	rep(i,1,n){
		scanf("%s",s[i]+1);
		rep(j,1,n)a[i][j]=s[i][j]-'0';
		f[i][i][i]=1;
	}
	per(l,n,2)rep(r,l,n)rep(p,l,r){
		rep(L,l+1,p)rep(R,p,r-1)
			if(f[L][p][R]){
				rep(x,l,L-1)rep(y,R+1,r)
					if(a[x][y]){
						//printf("%d %d %d  %d %d  %d %d\n",l,p,r,x,L,R,y);
						f[l][p][r]+=f[L][p][R]*f[l][x][L-1]*f[R+1][y][r];
					}
			}
		//printf("f[%d][%d][%d] = %lld\n",l,p,r,f[l][p][r]);
	}
	rep(i,2,n)
		if(a[1][i])ans+=f[2][i][n];
	cout<<ans<<endl;
	return 0;
}