#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cassert>
#include <vector>
using namespace std;

#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define FILLA(a, x) memset((a), (x), sizeof (a))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))
#define COPYA(a, b) memcpy((b), (a), sizeof (a))

typedef unsigned long long lu;
typedef long long li;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;

inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) { x = Sub(x - y); }
inline int Mul(int x, int y) { return (int)((lu)x * y % mod); }
inline int Mul(int x, int y, int z) { return (int)((lu)x * y % mod * z % mod); }

int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1) {
    if (y & 1) z = Mul(z, x);
    x = Mul(x, x);
  }
  return z;
}

int Inv(int x) { return Pow(x, mod - 2); }
template <class T> inline void Max(T &x, T y) { if (y > x) x = y; }
template <class T> inline void Min(T &x, T y) { if (y < x) x = y; }

// ----------------------------------------

const int maxn = 40;

int N, n, A[maxn][maxn];
li dp[maxn][maxn][maxn][maxn];
li dp2[maxn][maxn][maxn][maxn];

li DP(int a, int b, int c, int d);
li DP2(int a, int b, int c, int d);

li DP(int a, int b, int c, int d) {
  li &ans = dp[a][b][c][d];
  if (ans != -1) return ans;
  ans = 0;
  for (int p = a; p <= b; ++p) {
    for (int q = c; q <= d; ++q) {
      if (A[p][q]) {
        ans += DP2(a, p - 1, p + 1, b) * DP2(c, q - 1, q + 1, d);
      }
    }
  }
  return ans;
}

li DP2(int a, int b, int c, int d) {
  li &ans = dp2[a][b][c][d];
  if (ans != -1) return ans;
  if (a == b + 1 && c == d + 1) {
    return ans = 1;
  }
  ans = 0;
  for (int p = a; p <= b; ++p) {
    for (int q = c; q <= d; ++q) {
      ans += DP(a, p, q, d) * DP2(p + 1, b, c, q - 1);
    }
  }
  return ans;
}

int main(void) {
  FILLA(dp, -1);
  FILLA(dp2, -1);
  scanf("%d", &N);
  n = N * 2;
  for (int i = 0; i < n; ++i) {
    char s[100];
    scanf("%s", s);
    for (int j = 0; j < n; ++j) {
      A[i][j] = s[j] - '0';
    }
  }
  li ans = 0;
  for (int i = 1; i < n; ++i) {
    if (A[0][i]) {
      ans += DP2(1, i - 1, i + 1, n - 1);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
