# coding: utf-8 import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time sys.setrecursionlimit(10 ** 7) INF = 10 ** 20 MOD = 10 ** 9 + 7 def II(): return int(input()) def ILI(): return list(map(int, input().split())) def IAI(LINE): return [ILI() for __ in range(LINE)] def IDI(): return {key: value for key, value in ILI()} def read(): n = II() F = IAI(n) return (n, F) def solve(n, F): all_list = set() for i in range(1, n + 1): all_list.add(i) all_used = set() def find(set_used, set_left): if len(set_left) == 0: return 0 now_ret = -1 for i in itertools.combinations(list(set_left), 2): next_set_used = copy.copy(set_used) next_set_used.add(i[0]) next_set_used.add(i[1]) next_set_left = copy.copy(set_left) next_set_left.remove(i[0]) next_set_left.remove(i[1]) now_ret = max(now_ret, find(next_set_used, next_set_left) + F[i[0] - 1][i[1] - 1]) return now_ret ans = find(all_used, all_list) return ans def main(): params = read() print(solve(*params)) if __name__ == "__main__": main()