#include <bits/stdc++.h>

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

long d[50][50][50];

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    n *= 2;
    vector<vector<char>> a(n, vector<char>(n));
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < n; j++) {
            a[i][j] = s[j] == '1';
        }
    }
    for (int len = 0; len < n; len += 2) {
        for (int l = 0; l < n; l++) {
            for (int x = 0; x <= len; x++) {
                if (len == 0) {
                    d[len][l][x] = 1;
                    continue;
                }
                for (int q = 0; q < x; q++) {
                    for (int w = x + 1; w <= len; w++) {
                        if (a[(l + q) % n][(l + w) % n]) {
                            for (int qq = q; qq < x; qq++) {
                                for (int ww = x + 1; ww <= w; ww++) {
                                    d[len][l][x] +=
                                            d[qq][l][q] *
                                            d[len - ww][(l + ww) % n][w - ww] *
                                            d[ww - qq - 2][(l + qq + 1) % n][x - qq - 1];
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    long res = 0;
    for (int i = 1; i < n; i++) {
        if (a[0][i]) {
            res += d[n - 2][(i + 1) % n][n - i - 1];
        }
    }
    cout << res << "\n";

    return 0;
}