n = int(input()) F = [list(map(int, input().split())) for _ in range(n)] dp = [0] * (1 << n) for bit in range((1 << n) - 1): pc = 0 lst = [] for i in range(n): if bit >> i & 1: continue lst.append(i) pc += 1 if pc & 1: continue i = lst[0] for j in lst[1:]: dbit = (1 << i) | (1 << j) nbit = bit | dbit dp[nbit] = max(dp[nbit], dp[bit] + F[i][j]) print(dp[-1])