#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int N = 42;

int n;
int a[N][N];

ull dp[N][N][N][N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
    cin >> n;
    n *= 2;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            char c;
            cin >> c;
            if (c == '1') {
                a[i][j] = 1;
            }
        }
    }
    for (int i = 1; i < n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            dp[i][i - 1][j][j - 1] = 1;
        }
    }
    for (int i = n - 1; i > 0; --i) {
        for (int j = i; j < n; ++j) {
            for (int k = j + 1; k < n; ++k) {
                for (int l = k; l < n; ++l) {
                    for (int x = i; x <= j; ++x) {
                        for (int y = k; y <= l; ++y) {
                            if (!a[x][y]) {
                                continue;
                            }
                            for (int lf = i; lf <= x; ++lf) {
                                for (int rg = y; rg <= l; ++rg) {
                                    dp[i][j][k][l] = dp[i][j][k][l] + dp[i][lf - 1][rg + 1][l] * dp[lf][x - 1][x + 1][j] * dp[k][y - 1][y + 1][rg];
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    ull ans = 0;
    for (int i = 1; i < n; ++i) {
        if (a[0][i]) {
            ans += dp[1][i - 1][i + 1][n - 1];
        }
    }
    cout << ans << "\n";
	return 0;
}


