#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
//#include<cstdio>
//#include<algorithm>
//#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	int A[16][16];
	rep(i, N) rep(j, N) cin >> A[i][j];
	ll dp[1 << 16] = {};
	int n = 1 << N;
	rep1(i, N - 1) {
		int M = 1 << i;
		rep(j, M) {
			ll kari = dp[j];
			rep(k, i) if (j >> k & 1) kari += A[i][k];
			dp[M + j] = kari;
		}
	}
	rep1(i, n - 1) {
		for (int j = i - 1 & i; j > 0; j = j - 1 & i) {
			dp[i] = max(dp[i], dp[j] + dp[i ^ j]);
		}
	}
	co(dp[n - 1]);
	Would you please return 0;
}