import java.io.*; import java.util.*; public class Main { static ArrayList> base = new ArrayList<>(); static HashMap dp = new HashMap<>(); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); for (int i = 0; i < n; i++) { base.add(new HashSet<>()); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { int x = sc.nextInt(); if (i < j) { dp.put((1 << i) + (1 << j), x); base.get(i).add((1 << i) + (1 << j)); } } } System.out.println(dfw((1 << n) - 1)); } static int dfw(int mask) { if (!dp.containsKey(mask)) { int max = 0; int idx = getIdx(mask); for (int x : base.get(idx)) { if ((mask & x) != x) { continue; } max = Math.max(max, dfw(x) + dfw(mask ^ x)); } dp.put(mask, max); } return dp.get(mask); } static int getIdx(int mask) { int idx = 0; while (mask > 0) { if (mask % 2 == 1) { break; } idx++; mask >>= 1; } return idx; } } 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(); } }