#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ll score[1<<16], n, a[16][16];
	cin >> n;
	memset(score, 0, sizeof(score));
	for (int i=0; i<n; i++) 
		for (int j=0; j<n; j++)
			cin >> a[i][j];
	for (int i=0; i<(1<<n); i++)
		for (int j=0; j<n; j++)
			for (int k=j+1; k<n; k++)
				if (i&(1<<j) && i&(1<<k))
					score[i] += a[j][k];
	for (int i=0; i<(1<<n); i++)
		for (int j=1; j<i; j++)
			if (j+(j^i)==i)
				score[i] = max(score[i], score[j]+score[j^i]);
	
	cout << score[(1<<n)-1] << "\n";
}