import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.Scanner; public class Main { public static int solve_DP(int n, int[][] adj){ int[] DP = new int[1 << n]; final int INF = Integer.MAX_VALUE / 2 - 1; Arrays.fill(DP, INF); DP[0] = 0; for(int bit = 0; bit < (1 << n); bit++){ if(DP[bit] >= INF){ continue; } int i = 0; for(; (bit & (1 << i)) != 0; i++); final int fst = 1 << i; for(int j = i + 1; j < n; j++){ if((bit & (1 << j)) != 0){ continue; } final int snd = 1 << j; final int next_bit = bit | fst | snd; DP[next_bit] = Math.min(DP[next_bit], DP[bit] + adj[i][j]); } } return DP[(1 << n) - 1]; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int n = sc.nextInt(); final int max = 1000; int[][] adj = new int[n][n]; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ adj[i][j] = max - sc.nextInt(); } } final int solve = solve_DP(n, adj); System.out.println(max * (n / 2) - solve); } }