// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll mem[45][45][45];

int G[45][45];

ll dp(int s, int t, int u){

    if (s == u) return 1;

    else if (s == t || t == u) return 0;

    if (mem[s][t][u] != -1) return mem[s][t][u];

    //printf("%d %d %d\n",s,t,u);

    ll ans = 0;

    for (int p1 = s; p1 < t; p1++){

        for (int p2 = t+1; p2 <= u; p2++){

            //printf("can take %d-%d\n",p1,p2);

            for (int r1 = s; r1 <= p1; r1++){

                for (int r2 = p2; r2 <= u; r2++){

                    if (G[r1][r2] == 0) continue;

                    //printf("+%lld*%lld*%lld\n",dp(s,r1,p1),dp(p1+1,t,p2-1),dp(p2,r2,u));

                    ll num = dp(s,r1,p1)*dp(p1+1,t,p2-1)*dp(p2,r2,u);

                    //printf("if take %d-%d: add %lld\n",r1,r2,num);

                    ans += num;

                }

            }

        }

    }

    //printf("%d %d %d: %lld\n",s,t,u,ans);

    return mem[s][t][u] = ans;

}

int main(){

	int n;

	scanf("%d",&n);

	for (int i = 0; i < 2*n; i++){

        for (int j = 0; j < 2*n; j++){

            char x;

            scanf(" %c",&x);

            G[i][j] = x-'0';

        }

	}

	memset(mem,-1,sizeof(mem));

	ll ans = 0;

	for (int i = 1; i <= 2*n-1; i++){

        if (G[0][i]){

            ans += dp(1,i,2*n-1);

            //printf("if take 0-%d, %lld\n",i,dp(1,i,2*n-1));

        }

	}

	printf("%lld",ans);

}


// Faster C++ solution for the same problem (measured speedup: 1.6666393815983387x):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

ll dp[45][45][45];

int G[45][45];

int main(){

	int n;

	scanf("%d",&n);

	n *= 2;

	for (int i = 0; i < n; i++){

        for (int j = 0; j < n; j++){

            char x;

            scanf(" %c",&x);

            G[i][j] = x-'0';

        }

	}

	for (int l = 0; l < n; l++){

        for (int s = 1; s+l < n; s++){

            int u = s+l;

            for (int t = s; t <= u; t++){

                if (s == u) dp[s][t][u] = 1;

                else if (s == t || t == u) dp[s][t][u] = 0;

                else{

                    for (int p1 = s; p1 < t; p1++){

                        for (int p2 = t+1; p2 <= u; p2++){

                            //printf("can take %d-%d\n",p1,p2);

                            for (int r1 = s; r1 <= p1; r1++){

                                for (int r2 = p2; r2 <= u; r2++){

                                    if (G[r1][r2] == 0) continue;

                                    //printf("+%lld*%lld*%lld\n",dp(s,r1,p1),dp(p1+1,t,p2-1),dp(p2,r2,u));

                                    ll num = dp[s][r1][p1]*dp[p1+1][t][p2-1]*dp[p2][r2][u];

                                    //printf("if take %d-%d: add %lld\n",r1,r2,num);

                                    dp[s][t][u] += num;

                                }

                            }

                        }

                    }

                }

            }

        }

	}

	ll ans = 0;

	for (int i = 1; i <= n-1; i++){

        if (G[0][i]){

            ans += dp[1][i][n-1];

            //printf("if take 0-%d, %lld\n",i,dp(1,i,2*n-1));

        }

	}

	printf("%lld",ans);

}