#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<vector<long long>> a(N, vector<long long>(N));
    for (int i=0; i<N; i++)
    for (int j=0; j<N; j++)
        cin>>a[i][j];

    vector<long long> C(1<<N);
    for (int b=0; b<1<<N; b++)
        for (int i=0; i<N; i++)
        if (b>>i&1)
        for (int j=0; j<i; j++)
        if (b>>j&1)
            C[b] += a[i][j];

    vector<long long> T(1<<N);
    for (int b=0; b<1<<N; b++)
    {
        T[b] = C[b];
        for (int c=(b-1)&b; c>0; c=(c-1)&b)
            T[b] = max(T[b], T[b^c] + C[c]);
    }
    cout<<T[(1<<N)-1]<<endl;
}
