#include <iostream>
#include <cstdio>
#define int long long
using namespace std;
const int N = 45;
int n, a[N][N], f[N][N][N], g[N][N][N], ans;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
signed main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read(); n <<= 1;
	for(int i = 1; i <= n; i ++) for(int j = 1; j <= n; j ++) scanf("%1d", &a[i][j]);
	for(int i = 1; i < n; i ++)
	{
		f[i][i][i] = 1;
		for(int j = i + 1; j < n; j ++) g[i][i][j] = a[j][i];
	}
	for(int z = 3; z < n; z += 2)
		for(int i = 1; i <= n - z; i ++)
		{
			int j = i + z - 1;
			for(int p = i; p < j; p += 2)
				for(int q = j; q > p; q -= 2)
				{
					int sum = 0;
					for(int k = q; k <= j; k ++) sum += g[i][p][k] * f[q][j][k];
					for(int k = p + 1; k < q; k ++) f[i][j][k] += sum * f[p + 1][q - 1][k];
				}
			for(int w = i; w <= j; w ++)
				for(int k = j + 1; k < n; k ++)
					g[i][j][k] += f[i][j][w] * a[k][w];
		}
	for(int i = 1; i < n; i ++) if(a[n][i]) ans += f[1][n - 1][i];
	printf("%lld\n", ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
