#include <bits/stdc++.h>
#define ll long long
#define db long double
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

ll dp[40][40][40][40];
ll forest[40][40][40][40];

int n;

void mod(int &a){
	a %= (2*n);
	if (a < 0) a += 2*n;
}

ll get_f(int a, int b, int c, int d){
	mod(a), mod(b), mod(c), mod(d);
	//cout << "=====" << a << " " << b << " " << c << " " << d << endl;
	return forest[a][b][c][d];
}

ll get_dp(int a, int b, int c, int d){
	mod(a), mod(b), mod(c), mod(d);
	return dp[a][b][c][d];
}

int main(){
#ifdef LOCAL
	freopen("N_input.txt", "r", stdin);
	//freopen("H_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	char matrix[2*n][2*n];
	for (int i=0; i < 2*n; ++i) for (int j=0; j < 2*n; ++j) cin >> matrix[i][j];
	for (int mx=0; mx < 2*n; mx++) for (int len1=0; len1 <= mx; ++len1) for (int len2=0; len2 <= mx; ++len2){
		if (len1 != mx && len2 != mx) continue;
		for (int a=0; a < 2*n; ++a) for (int c=0; c < 2*n; ++c){
			int b = (a+len1)%(2*n), d = (c+len2)%(2*n);
			if (!(a <= b && b <= c && c <= d)) continue;
			bool good = true;
			vector<int> F, S;
			for (int p=0; p < 2*n; ++p){
				int tut = 0;
				if (a <= b && a <= p && p <= b){
					tut++;
					F.push_back(p);
				}
				if (a > b && (p >= a || p <= b)){
					tut++;
					F.push_back(p);
				}
				if (c <= d && c <= p && p <= d) {
					tut++;
					S.push_back(p);
				}
				if (c > d && (p >= c || p <= d)){
					tut++;
					S.push_back(p);
				}
				if (tut==2) good = false;
			}
			if (!good) continue;
			for (int i=0; i < F.size(); ++i) for (int j=0; j < S.size(); ++j){
				int e = F[i], f = S[j];
				if (matrix[e][f] == '1'){
					ll val1 = 0, val2 = 0;
					if (a==b) val1=1;
					else if (e != a && e != b) val1 = get_f(a, e-1, e+1, b);
					if (c==d) val2=1;
					else if (f != c && f != d) val2 = get_f(c, f-1, f+1, d);
					dp[a][b][c][d] += val1*val2;
				}
				if (e==b && f==c){
					continue;
				}
				else{
					if (e != b && f != c){
						//if (a==1 && b==2 && c==4 && d==5) cout << a << " " << e << " " <<f << " " << d << endl;
						forest[a][b][c][d] += get_dp(a, e, f, d) * get_f(e+1, b, c, f-1);
					}
				}
			}
			forest[a][b][c][d] += dp[a][b][c][d];
		}
	}
	//cout << dp[1][1][3][5] << " " << forest[1][1][3][5] << endl;
	//cout << dp[0][0][1][5] << endl;
	int ans = 0;
	cout << dp[0][0][1][2*n-1];
}