//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define trav(x,a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), x.end()
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
const int N = 1e6 + 5;
const double eps = 1e-9;
int a[50][50];
ll dp[50][50][50][50];

ll dfs(int i1, int j1, int i2, int j2) {
  if (i1 > j1 || i2 > j2 || j1 >= i2 || (j1 - i1) % 2 != (j2 - i2) % 2)
    return 0;
  if (i1 == j1 && i2 == j2)
    return a[i1][j2];
  if (~dp[i1][j1][i2][j2]) 
    return dp[i1][j1][i2][j2];
  ll& ret = dp[i1][j1][i2][j2];
  ret = 0;
  if (i1 == j1) {
    for (int j = i2; j <= j2; j++) if (a[i1][j])
      ret += dfs(i2, j-1, j+1, j2);
    return ret;
  }
  if (i2 == j2) {
    for (int i = i1; i <= j1; i++) if (a[i][j2])
      ret += dfs(i1, i-1, i+1, j1);
    return ret;
  }
  for (int i = i1; i <= j1; i++) {
    for (int j = j2; j >= i2; j--) if (a[i][j]) {
      if (i == i1 && j == j2)
        ret += dfs(i1+1, j1, i2, j2-1);
      else if (i == i1) {
        for (int jj = i2; jj < j; jj++)
          ret += dfs(jj, j-1, j+1, j2) * dfs(i+1, j1, i2, jj-1);
      } else if (j == j2) {
        for (int ii = i+1; ii <= j1; ii++)
          ret += dfs(i1, i-1, i+1, ii) * dfs(ii+1, j1, i2, j-1);
      } else {
        for (int ii = i+1; ii <= j1; ii++) {
          ll x = dfs(i1, i-1, i+1, ii);
          if (x == 0) continue;
          for (int jj = i2; jj < j; jj++)
            ret += x * dfs(jj, j-1, j+1, j2) * (ii == j1 && jj == i2 ? 1ll : dfs(ii+1, j1, i2, jj-1));
        }
      }
    }
  }
  return ret;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n; cin >> n;
  for (int i = 1; i <= 2*n; i++) {
    string s; cin >> s;
    for (int j = 1; j <= 2*n; j++)
      a[i][j] = s[j-1]-'0';
  }
  if (n == 1) {
    if (a[1][2])
      cout << "1\n";
    else
      cout << "0\n";
    return 0;
  }
  ll ans = 0;
  memset(dp, -1, sizeof dp);
  for (int i = 3; i < 2*n; i++) if (a[1][i]) {
    ans += dfs(2, i-1, i+1, 2*n);
  }
  cout << ans << endl;
  return 0;
}


/*
3
011111
101111
110111
111011
111101
111110
3

4
01111100
10011111
10011100
11101111
11110111
11111011
01011101
01011110
6

8
0111101111111111
1011101111111111
1101101111011101
1110111111111111
1111011111110111
0001101111111111
1111110111011111
1111111011111111
1111111101111111
1111111110111111
1101110111011111
1111111111101111
1111011111110111
1111111111111011
1101111111111101
1111111111111110
4762
*/

Measured memory_bytes: 52384