#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
ll a[16][16];
ll dp[1 << 16];
ll sum[1 << 16];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) cin >> a[i][j];
	}
	for (int bit = 0; bit < (1 << N); bit++) {
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				if ((bit&(1 << i)) && (bit&(1 << j))) {
					sum[bit] += a[i][j];
				}
			}
		}
	}
	fill(dp, dp + (1 << 16), -(1LL << 60));
	dp[0] = 0;
	for (int bit = 1; bit < (1 << N); bit++) {
		for (int sub = bit; sub; sub = (sub - 1)&bit) {
			dp[bit] = max(dp[bit], dp[bit^sub] + sum[sub]);
		}
	}
	cout << dp[(1 << N) - 1] << endl;
}