#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int N = 45;
 
template <typename T> inline void read(T &AKNOI) {
    T x = 0, flag = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
        if (ch == '-') flag = -1;
        ch = getchar();
    }
    while (isdigit(ch)) {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    AKNOI = flag * x;
}
 
char g[N][N];
int n;
LL dp[N][N][N];
 
LL DP(int l, int r, int k) {
	LL &ret = dp[l][r][k];
	if (~ret) return ret;
	if (l == r) return ret = 1;
	if (l == k || r == k) return ret = 0;
	ret = 0;
	for (int x = l; x < k; ++x) {
		for (int y = k + 1; y <= r; ++y) {
			if (g[x][y] == '0') continue;
			for (int p = x; p < k; ++p) {
				for (int q = k + 1; q <= y; ++q) {
					ret += DP(l, p, x) * DP(p + 1, q - 1, k) * DP(q, r, y);
				}
			}
		}
	}
	return ret;
}
 
void init() {
	read(n);
	for (int i = 1; i <= n * 2; ++i) {
		scanf("%s", g[i] + 1);
	}
}
 
void solve() {
	mset(dp, -1);
	LL ans = 0;
	for (int i = 2; i <= n * 2; ++i) {
		if (g[1][i] == '1') {
			ans += DP(2, n * 2, i);
		}
	}
	printf("%lld\n", ans);
}
 
int main() {
	init();
	solve();
	return 0;
}