#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 42;

ll dp[N][N][N];
int n;
char s[N][N];

ll solve(int l, int p, int r) {
  if (l == p && p == r) return 1;
  if (dp[l][p][r] != -1) return dp[l][p][r];
  ll &res = dp[l][p][r];
  res = 0;
  for (int a = l; a < p; a++) {
    for (int b = r; b > p; b--) {
      for (int x = l; x <= a; x++) {
        for (int y = r; y >= b; y--) if (s[x][y] == '1') {
          res += solve(l, x, a) * solve(b, y, r) * solve(a + 1, p, b - 1);
        }
      }
    }
  }
  return res;
}

int main() {
  cin >> n;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= 2 * n; i++) scanf("%s", s[i] + 1);
  ll ans = 0;
  for (int i = 2; i <= 2 * n; i++) {
    if (s[1][i] == '1') {
      ans += solve(2, i, 2 * n);
    }
  }
  cout << ans << endl;
  return 0;
}