#include using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } ll dp[1<<24]; signed main(){ int n;cin>>n; vector> f(n,vector(n)); rep(i,n)rep(j,n) cin>>f[i][j]; rep(i,1<<24) dp[i]=-LINF; dp[0]=0; for(int bit=0;bit<(1<<24);bit++){ int bits=__builtin_popcount(bit); if(bits%2 or bits==n) continue; int fs; rep(i,n)if(!(bit>>i&1)){ fs=i; break; } int nxt=bit|(1<>j)&1)) chmax(dp[nxt|(1<