#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}

const int N=44;
int f[N][N][N];
int dp[N][N][N];
int a[N][N];
int32_t main(){
    int n;
    cin>>n;
    n+=n;
    forn(i,n)forn(j,n){
        char c;
        cin>>c;
        a[i][j]=c-'0';
    }
    forn(i,n){
        f[i][i][i]=1;
    }
    int op=0;
    for(int len=3;len<=n;len+=2){
        for(int l=1;l+len-1<n;++l){
            int r=l+len-1;
            for(int c=l+1;c<r;c++){
                int&res=f[l][r][c];
                for(int ls=l;ls<c;++ls){
                    for(int cl=l;cl<=ls;++cl){
                        for(int rs=c+1;rs<=r;++rs){
                            for(int cr=rs;cr<=r;++cr){
                                op++;
                                // dbg(l,r,ls,rs,cl,cr);
                                if(a[cl][cr]){
                                    res+=f[l][ls][cl]*f[rs][r][cr]*f[ls+1][rs-1][c];
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    dbg(op);
    int ans=0;
    for(int mid=1;mid<n;++mid){
        if(!a[0][mid])continue;
        dp[mid][0][n]=1;
        // dbg(mid);
        for(int l=1;l<mid;++l){
            for(int r=n-1;r>mid;--r){
                int&res=dp[mid][l][r];
                // dbg(l,r);
                for(int ls=1;ls<=l;++ls){
                    for(int rs=n-1;rs>=r;--rs){
                        // dbg(ls,rs);
                        for(int cl=ls;cl<=l;++cl){
                            for(int cr=rs;cr>=r;--cr){
                                // dbg(l,r,ls,rs,cl,cr);
                                op++;
                                if(a[cl][cr]){
                                    // dbg(l,r,ls,rs,cl,cr);
                                    res+=f[ls][l][cl]*f[r][rs][cr]*dp[mid][ls-1][rs+1];
                                }
                            }
                        }
                    }
                }
            }
        }
        dbg(mid,dp[mid][mid-1][mid+1]);
        ans+=dp[mid][mid-1][mid+1];
    }
    cout<<ans<<'\n';
    dbg(op);


    return 0;
}
/*
3
010111
101111
010111
111011
111101
111110
*/

Measured memory_bytes: 1024