#include <iostream>
using namespace std;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n; cin >> n;
    long a[16][16];
    for(int i=0; i < n; ++i) for(int j=0; j < n; ++j) cin >> a[i][j];

    long S[1<<16] = {0};
    for(int bit = 1; 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)) S[bit] += a[i][j];

    long dp[1<<16] = {0};
    for(int bit = 1; bit < (1<<n); ++bit) 
        for(int i = bit; i; i = (i-1) & bit) dp[bit] = max(dp[bit], S[i] + dp[bit ^ i]);

    cout << dp[(1<<n)-1] << endl;
    return 0;
}