#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=20*2;


int n;
char s[MAXN][MAXN+1];
bool can[MAXN][MAXN];

ll dp[MAXN][MAXN][MAXN]; // dp[a][b][c] = #ways to make a tree from vertices [a..c] given that a is connected with b

ll solve() {
	REP(i,n) REP(j,n) can[i][j]=s[i][j]=='1';

	for(int a=n-1;a>=0;--a) FOR(c,a+1,n) FORE(b,a+1,c) {
		int len=c-a+1;
		if(len==2) { dp[a][b][c]=b==c?1:0; continue; }
		dp[a][b][c]=0;
		FOR(x,a+1,b) FORE(y,b+1,c) if(can[x][y]) {
			FOR(aa,x,b) FORE(bb,b+1,y) dp[a][b][c]+=dp[a][x][aa]*dp[aa][b][bb-1]*dp[bb-1][y][c];
		}
	}

	ll ret=0; FOR(i,1,n) if(can[0][i]) ret+=dp[0][i][n-1]; return ret;
}

void run() {
	scanf("%d",&n); n*=2;
	REP(x,n) scanf("%s",s[x]);
	printf("%lld\n",solve());
}

void stress() {
	n=MAXN;
	REP(x,n) REP(y,n) s[x][y]=x==y?'0':'1';
	REP(x,n) s[x][n]='\0';
	ll ret=solve(); printf("ret=%lld\n",ret);
}

int main() {
	run();
	//stress();
	return 0;
}
