#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=42;
ll d2[N][N][N][N],d1[N][N][N][N];
int x[N][N];char s[N];
int main(){
//  freopen("2.in","r",stdin);
//  freopen("a.out","w",stdout);
    int n,a,b,c,d,i,j;ll tmp;
    scanf("%d",&n);
    if(n==1){
        scanf("%s",s);
        putchar(s[1]);
        return 0;
    }
    n<<=1;
    for(a=1;a<=n;++a){
        scanf("%s",s+1);
        for(b=1;b<=n;++b){
            x[a][b]=s[b]^'0';
        }
    }
    /*
    for(a=1;a<=n;++a){
        for(b=1;b<=n;++b){
            printf("%d ",x[a][b]);
        }
        printf("\n");
    }
    */
    for(a=1;a<=n;++a){
        for(b=1;b<=n;++b)if(x[a][b]){
            d1[a][a][b][b]=1ll;
        }
    }
    for(a=0;a<=n;++a){
        for(b=0;b<=n;++b){
            d2[a+1][a][b+1][b]=1ll;
        }
    }
    for(d=3;d<=n;++d){
        for(a=d-1;a!=1;--a){
            for(b=a;b<=d;++b){
                for(c=d;c!=b;--c){
                    if(a!=b||c!=d){
                        tmp=0ll;
                        for(i=a;i<=b;++i){
                            for(j=c;j<=d;++j)if(x[i][j]){
                                tmp+=d2[a][i-1][i+1][b]*d2[c][j-1][j+1][d];
                            }
                        }
                        d1[a][b][c][d]=tmp;
//                      printf("d1 %d %d %d %d = %lld\n",a,b,c,d,tmp);
                    }
                    {
                        tmp=0ll;
                        for(i=a;i<=b;++i){
                            for(j=c;j<=d;++j){
                                tmp+=d1[a][i][j][d]*d2[i+1][b][c][j-1];
                            }
                        }
                        d2[a][b][c][d]=tmp;
//                      printf("d2 %d %d %d %d = %lld\n",a,b,c,d,tmp);
                    }
                }
            }
        }
    }
    tmp=0ll;
    for(i=2;i!=n;++i)if(x[1][i]){
//      printf("D2 2 %d %d %d = %lld\n",i-1,i+1,n,d2[2][i-1][i+1][n]);
        tmp+=d2[2][i-1][i+1][n];
    }
    printf("%lld",tmp);
    return 0;
}