#include "bits/stdc++.h"
using namespace std;
long long a[1<<16],f[1<<16],tmp;
int b[1<<16];
int lowbit(int x)
{
    return x&(-x);
}
int main()
{
    int n;
    int i,j;
    int x,y,z,p,q;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
	for(j=1;j<=n;j++)
	{
	    scanf("%lld",&tmp);
	    q=(1<<(n-i))+(1<<(n-j));
	    a[q]=tmp;
	}
	b[1<<(n-i)]=i;
    }
    for(i=1;i<(1<<n);i++)
    {
	if(a[i])
	{
	    continue;
	}
        x=lowbit(i);
	y=b[x];
	z=x^i;
        a[i]=a[z];
	while(z)
	{
	    p=lowbit(z);
	    q=(1<<(n-y))+(1<<(n-b[p]));
	    a[i]+=a[q];
	    z-=p;
	}		 
    }
    for(i=0;i<(1<<n);i++)
    {
	for(j=i;j;j=(j-1)&i)
	{
	    f[i]=max(f[i],a[j]+f[j^i]);
	}
    }
    printf("%lld\n",f[(1<<n)-1]);
    return 0;
}