#include using namespace std; #define int long long int n, a[25][25], dp[1 << 24], tong[25], cnt; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n; i ++ ) for (int j = 0; j < n; j ++ ) cin >> a[i][j]; for (int i = 3; i < (1 << n); i ++ ) { if (__builtin_popcount(i) & 1) continue; int cnt = 0; for (int j = 0; j < n; j ++ ) if (i >> j & 1) tong[ ++ cnt] = j; for (int j = 2; j <= cnt; j ++ ) dp[i] = max(dp[i - (1 << tong[1]) - (1 << tong[j])] + a[tong[1]][tong[j]], dp[i]); } cout << dp[(1 << n) - 1]; return 0; }