#include <bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr int N = 40;
int a[N][N];
LL f[N][N][N];
LL solve(int l, int r, int m) {
    assert(0 <= l && l <= m && m <= r && r <= 39);
    if (f[l][r][m] != -1)
        return f[l][r][m];
    if (l == r)
        return f[l][r][m] = 1;
    LL result = 0;
    for (int i = l; i < m; ++i)
        for (int j = m + 1; j <= r; ++j)
            if (a[i][j] == 1)
                for (int x = i; x < m; ++x)
                    for (int y = m + 1; y <= j; ++y)
                        result += solve(l, x, i) * solve(y, r, j) * solve(x + 1, y - 1, m);
    return f[l][r][m] = result;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    memset(f, -1, sizeof(f));
    int n;
    cin >> n;
    for (int i = 0; i < 2 * n; ++i) {
        for (int j = 0; j < 2 * n; ++j) {
            char c;
            cin >> c;
            a[i][j] = c - '0';
        }
    }
    LL ans = 0;
    for (int i = 1; i < 2 * n; ++i)
        if (a[0][i] == 1)
            ans += solve(1, 2 * n - 1, i);
    cout << ans << endl;
    return 0;
}