#include using namespace std; int board[25][25]; int dp[1 << 24]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> board[i][j]; } } memset(dp, -1, sizeof(dp)); dp[0] = 0; for (int i = 0; i < (1 << n); i++) { if (__builtin_popcount(i) % 2 == 1) continue; for (int j = 0; j < n; j++) { if ((i & (1 << j)) == 0) { for (int k = j + 1; k < n; k++) { if ((i & (1 << k)) == 0) { int mask = i + (1 << j) + (1 << k); dp[mask] = max(dp[mask], dp[i] + board[j][k]); } } } break; } } cout << dp[(1 << n) - 1] << '\n'; return 0; }