#include<bits/stdc++.h>
using namespace std;

using ll = long long;

const int MAXN = 44;
int N;
bool A[MAXN*2][MAXN*2];

ll dp[MAXN][MAXN][MAXN];
// inclusive range, with b chosen as special
ll go(int a, int b, int c) {
	if (dp[a][b][c] != -1) {
		return dp[a][b][c];
	}
	if (a == b && c == b) {
		return dp[a][b][c] = 1;
	} else if (a == b || c == b) {
		return dp[a][b][c] = 0;
	}

	ll ans = 0;
	for (int p1 = a; p1 <= b-1; p1++) {
		for (int p2 = b+1; p2 <= c; p2++) {
			for (int q1 = p1; q1 <= b-1; q1++) {
				for (int q2 = p2; q2 >= b+1; q2--) {
					ans += A[p1][p2] * go(a, p1, q1) * go(q1+1, b, q2-1) * go(q2, p2, c);
				}
			}
		}
	}
	return dp[a][b][c] = ans;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N; N *= 2;
	for (int i = 0; i < N; i++) {
		string s; cin >> s;
		for (int j = 0; j < N; j++) {
			A[i][j] = bool(s[j] - '0');
		}
	}
	memset(dp, -1, sizeof(dp));
	ll ans = 0;
	for (int i = 1; i < N; i++) {
		if (A[0][i]) {
			ans += go(1, i, N-1);
		}
	}
	cout << ans << '\n';

	return 0;
}
