#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e16;
int n,a[20][20];
ll s[70010],f[70010];
void upd(ll &x,ll v)
{
	x=max(x,v);
}
int main()
{
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	{
		for (int j=0;j<n;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for (int mask=1;mask<(1<<n);mask++)
	{
		f[mask]=-inf;
		for (int i=0;i<n;i++)
		{
			if (!(mask&(1<<i)))
			{
				continue;
			}
			for (int j=i+1;j<n;j++)
			{
				if (!(mask&(1<<j)))
				{
					continue;
				}
				s[mask]+=a[i][j];
			}
		}
		//cerr<<mask<<" "<<s[mask]<<endl;
	}
	for (int mask=1;mask<(1<<n);mask++)
	{
		for (int h=mask;h;h=(h-1)&mask)
		{
			upd(f[mask],f[mask^h]+s[h]);
		}
		//cerr<<mask<<" "<<f[mask]<<endl;
	}
	cout<<f[(1<<n)-1]<<endl;
	return 0;
}
