input = raw_input range = xrange def read_data(): n = int(input()) F = [list(map(int, input().split())) for _ in range(n)] return n, F def solve(n, F): dp = [0] * (1 << n) mmax = max for mask in xrange(1, 1 << n): pos = [i for i in range(n) if mask & (1 << i)] if len(pos) & 1: continue val = 0 for i in pos: Fi = F[i] for j in pos: if j >= i: break val = mmax(val, dp[mask - (1 << i) - (1 << j)] + Fi[j]) dp[mask] = val return dp[-1] n, F = read_data() print(solve(n, F))