/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author rahdirigs
 */

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

template <typename T> void s_max(T& a, T b) {
	if (a < b) {
		a = b;
	}
}

class TaskU {
public:
	int N;
	vector<vector<int>> a;
	vector<ll> dp, scores;
	vector<int> rem;

	void solve(std::istream& in, std::ostream& out) {
		in >> N;
		a.resize(N, vector<int> (N));
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				in >> a[i][j];
			}
		}
		scores.resize(1 << N, 0);
		dp.resize(1 << N, 0);
		pre_calc();
		for (int mask = 0; mask < (1 << N); mask++) {
			rem.clear();
			for (int i = 0; i < N; i++) {
				if (!(mask & (1 << i))) rem.push_back(i);
			}
			rec(0, dp[mask], mask, 0);
		}
		out << dp[(1 << N) - 1];
	}

	void pre_calc() {
		for (int mask = 0; mask < (1 << N); mask++) {
			for (int i = 0; i < N; i++) {
				for (int j = i + 1; j < N; j++) {
					if ((mask & (1 << i)) && (mask & (1 << j)))
						scores[mask] += a[i][j];
				}
			}
		}
	}

	void rec(int pos, ll score, int mask, int group) {
		if (pos == (int) rem.size()) {
			s_max(dp[mask], score + scores[group]);
			return;
		}
		rec(pos + 1, score, mask ^ (1 << rem[pos]), group ^ (1 << rem[pos]));
		rec(pos + 1, score, mask, group);
	}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	TaskU solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

#include<bits/stdc++.h>
#define MOD (long long)(1e9+7)
using namespace std;
long long n,a[20][20],dp[1<<17],sum[1<<17];
int main()
{
	cin >> n;
	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))) sum[i]+=a[j][k];
	for(int i=0; i<(1<<n); i++)
	{
		vector<int> pos;
		for(int j=0; j<n; j++) if(i&(1<<j)) pos.push_back(1<<j);
		int m=pos.size();
		for(int j=0; j<(1<<m); j++)
		{
			int c=0;
			for(int k=0; k<m; k++) if(j&(1<<k)) c+=pos[k];
			dp[i]=max(dp[i],dp[i-c]+sum[c]);
		}
	}
	long long ans=0;
	for(int i=0; i<(1<<n); i++) ans=max(ans,dp[i]);
	cout << ans;
	return 0;
}