#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 51;
int n;
char s[N][N];

ll f[N][N][N][N],g[N][N][N][N];
inline ll dfs(int l,int r,int L,int R);
inline ll dfs2(int l,int r,int L,int R){
	if (l>r&&L>R) return 1;
	if (l>r||L>R) return 0;
	if (~g[l][r][L][R]) return g[l][r][L][R];
	ll ret=0;
	For(i,l,r) For(j,L,R) if (s[i][j]){
		ret+=dfs(l,i-1,i+1,r)*dfs(L,j-1,j+1,R);
	}
	return g[l][r][L][R]=ret;
}
inline ll dfs(int l,int r,int L,int R){
	if (l==r&&L==R) return s[l][R];
	if (l>r&&L>R) return 1;
	if (l>r||L>R) return 0;
	if (~f[l][r][L][R]) return f[l][r][L][R];
	ll ret=0;
	For(i,l-1,r) For(j,L,R+1) if (i!=r||j!=L){
		ret+=dfs(l,i,j,R)*dfs2(i+1,r,L,j-1);
	}
	return f[l][r][L][R]=ret;
}

int main(){
	n=read()*2;
	For(i,1,n){
		scanf("%s",s[i]+1);
		For(j,1,n) s[i][j]-='0';
	}
	if (n==2) return printf("%d\n",s[1][2]),0;
	ll ans=0;
	fil(f,-1),fil(g,-1);
	For(i,3,n) if (s[1][i]) ans+=dfs(2,i-1,i+1,n);
	printf("%lld\n",ans);
}