#include<cstdio>
#define ll long long 
#include<algorithm>
int n,a[25][25];
ll f[70050];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++)scanf("%d",&a[i][j]);
	int lim=1<<n;
	for (int i=1;i<lim;i++)
		for (int j=1;j<=n;j++)if ((i&(1<<(j-1))))
			for (int k=j+1;k<=n;k++)if ((i&(1<<(k-1))))f[i]+=a[j][k];
	for (int i=1;i<lim;i++)
		for (int j=i;j;j=i&(j-1))f[i]=std::max(f[i],f[i-j]+f[j]);
	printf("%lld\n",f[lim-1]);
}