#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector<string> A(2*N);
	for(int i = 0; i < 2*N; i++) cin >> A[i];
	cat dp_subt[40][40][40];
	memset(dp_subt, 0, 40*40*40*sizeof(cat));
	for(int i = 0; i < 2*N; i++) dp_subt[i][i][i] = 1;
	for(int d = 3; d <= 2*N; d += 2) for(int l = 0; l <= 2*N-d; l++) {
		int r = l+d-1;
		for(int c = l+1; c < r; c++)
			for(int a = l; a < c; a++) for(int b = c+1; b <= r; b++) if(A[a][b] == '1')
				for(int i = a; i < c; i++) for(int j = c+1; j <= b; j++)
					// l..i (a), j..r (b), i+1..j-1 (c)
					dp_subt[l][r][c] += dp_subt[l][i][a] * dp_subt[j][r][b] * dp_subt[i+1][j-1][c];
	}
	cat ans = 0;
	for(int c = 1; c < 2*N; c++) if(A[0][c] == '1')
		ans += dp_subt[1][2*N-1][c];
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing
