#include <bits/stdc++.h>
using namespace std;
typedef long long lnt;
const lnt INF = 0x3f3f3f3f3f3f3f3fLL;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, a[16][16]; lnt f[1<<16];
int main() {
	read(n);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++) read(a[i][j]);
	for (int x = 0; x < (1<<n); x++)
		for (int i = 0; i < n; i++)
			for (int j = i+1; j < n; j++)
				if ((x>>i&1) && (x>>j&1)) f[x] += a[i][j];
	for (int i = 0; i < (1<<n); i++)
		for (int j = i; j; j = (j-1)&i)
			f[i] = max(f[i], f[j]+f[i^j]);
	return printf("%lld\n", f[(1<<n)-1]), 0;
}
