#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define FIR first
#define SEC second
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=41;
ll f[N][N][N][N],g[N][N][N][N];
int vis[N][N][N][N];
int n,E[N][N];
void dfs(int a,int b,int c,int d) {
    if(vis[a][b][c][d]) return;
    vis[a][b][c][d]=1;
    if(b==a-1&&d==c-1) {
        g[a][b][c][d]=f[a][b][c][d]=1;
        return;
    }
    if(b<a||d<c) return;
    for(int x=a;x<=b;++x)
        for(int y=c;y<=d;++y) if(E[x][y]) {
            dfs(a,x-1,x+1,b),dfs(c,y-1,y+1,d);
            g[a][b][c][d]+=f[a][x-1][x+1][b]*f[c][y-1][y+1][d];
        }
    f[a][b][c][d]=g[a][b][c][d];
    for(int x=a;x<b;++x)
        for(int y=c+1;y<=d;++y) {
            dfs(a,x,y,d),dfs(x+1,b,c,y-1);
            f[a][b][c][d]+=f[a][x][y][d]*g[x+1][b][c][y-1];
        }
}
char str[N];
int main() {
    rd(n); n*=2;
    for(int i=1;i<=n;++i) {
        scanf("%s",str+1);
        for(int j=1;j<=n;++j) E[i][j]=str[j]-'0';
    }
    ll ans=0;
    for(int i=2;i<=n;++i) if(E[1][i]) {
        dfs(2,i-1,i+1,n);
        ans+=f[2][i-1][i+1][n];
    }
    printf("%lld",ans);
    return 0;
}