#include <bits/stdc++.h>
long long f[50][50][50], n, N, ans;
char s[50][50];
long long dp(long long l, long long r, long long mid) {
  if (f[l][r][mid] != -1) return f[l][r][mid];
  if (l == r) return f[l][r][mid] = 1;
  if (l == mid || mid == r) return f[l][r][mid] = 0;
  long long ans = 0;
  for (long long j = l; j <= mid - 1; j++)
    for (long long k = mid + 1; k <= r; k++)
      if (s[j][k] == '1')
        for (long long p = j; p <= mid - 1; p++)
          for (long long q = mid + 1; q <= k; q++)
            ans += dp(l, p, j) * dp(p + 1, q - 1, mid) * dp(q, r, k);
  return f[l][r][mid] = ans;
}
signed main() {
  scanf("%lld", &n);
  N = 2 * n;
  for (long long i = 1; i <= N; i++) scanf("%s", s[i] + 1);
  memset(f, -1, sizeof(f));
  for (long long i = 2; i <= N; i++)
    if (s[1][i] == '1') ans += dp(2, N, i);
  printf("%lld\n", ans);
  return 0;
}
