#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

const int mod = 1000000007;

int N,A[16][16]; long long S[1<<16],D[1<<16];

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 i=1;i<(1<<N);i++){
		int x = i & (-i);
		for (int j=0;j<N;j++) if (x == (1 << j)){
			S[i] = S[i-x];
			for (int k=j+1;k<N;k++) if (i & (1 << k)){
				S[i] += A[j][k];
			}
		}
	}

	for (int i=1;i<(1<<N);i++){
		D[i] = -1e18;
		for (int j=i;j;j=(j-1)&i){
			if (D[i] < D[i-j] + S[j])
				D[i] = D[i-j] + S[j];
		}
	}

	printf ("%lld\n",D[(1<<N)-1]);

	return 0;
}