import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int half = n / 2; ArrayList> list = new ArrayList<>(); for (int i = 0; i < half; i++) { list.add(new HashMap<>()); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { int x = sc.nextInt(); if (i < j) { list.get(0).put((1 << i) + (1 << j), x); } } } for (int i = 0; i < half - 1; i++) { for (int x : list.get(i).keySet()) { for (int y : list.get(0).keySet()) { if ((x | y) != (x ^ y)) { continue; } list.get(i + 1).put(x | y, Math.max(list.get(i + 1).getOrDefault(x | y, 0), list.get(i).get(x) + list.get(0).get(y))); } } } System.out.println(list.get(half - 1).get((1 << n) - 1)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }