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

typedef long long LL;
typedef pair<LL, LL> PII;
typedef vector<LL> VI;

#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(LL i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(LL i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

const double PI = acos(-1.0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const LL INF = 1000 * 1000 * 1000;
const LL MAX = 2000 * 1000 + 5;
const LL MAX2 = 1000 * 1000 + 2;
const LL MAX20 = MAX2 * 10;
LL dp[40][40][40];
int n;
int a[40][40];
int main()
{
	//ios_base::sync_with_stdio(0);
	scanf("%d" , &n);
	n *= 2;
	
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
		{
			scanf("%1d" , &a[i][j]);
			//cout << a[i][j];
		}
		//cout << endl;
	}
	
	for(int i = 0; i < n; i++)
		dp[i][i][i] = 1;
	for(int len = 2; len <= n; len++)
		for(int l = 0; l < n - len + 1; l++)
		{
			int r = l + len - 1;
			for(int c = l; c <= r; c++)
				for(int c1 = l; c1 < c; c1++)
					for(int r1 = c1; r1 < c; r1++)
					{
						int l2 = r1 + 1;
						for(int r2 = c; r2 < r; r2++)
						{
							int l3 = r2 + 1;
							for(int c2 = l3; c2 <= r; c2++)
							{
								if(!a[c1][c2])
									continue;
								dp[l][c][r] += dp[l][c1][r1] * dp[l2][c][r2] * dp[l3][c2][r];
							}
						}
					}
		}
	LL ans = 0;
	for(int i = 1; i < n; i++)
		if(a[0][i])
			ans += dp[1][i][n - 1];
	cout << ans;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}
