N = int(input()) A = tuple(tuple(map(int, input().split())) for _ in range(N)) dp = [0] * (1 << N) for b in range(1 << N): if b.bit_count() % 2 == 1: continue for i in range(N): if b >> i & 1: continue for j in range(i + 1, N): if b >> j & 1: continue dp[b | 1 << i | 1 << j] = max(dp[b | 1 << i | 1 << j], dp[b] + A[i][j]) print(dp[-1])