local mmi, mma = math.min, math.max
local bls, brs = bit.lshift, bit.rshift
local bor = bit.bor
local mfl, mce = math.floor, math.ceil
local n = io.read("*n")
local edge = {}
for i = 1, n do
  edge[i] = {}
  for j = 1, n do
    edge[i][j] = io.read("*n")
  end
end
if n == 1 then
  print(0)
  os.exit()
elseif n == 2 then
  print(mma(0, edge[1][2]))
  os.exit()
end

local all = bls(1, n)
local bdp = {}
local inf = 1000000007 * 1000
for i = 1, all - 1 do
  bdp[i] = -inf
end

local edgesum = {}
for it = 1, all - 1 do
  local tmp = it
  local box = {}
  for j = n, 1, -1 do
    if tmp % 2 == 1 then
      table.insert(box, j)
    end
    tmp = brs(tmp, 1)
  end
  local c = 0
  for i = 1, #box - 1 do
    for j = i + 1 , #box do
      c = c + edge[box[i]][box[j]]
    end
  end
  edgesum[it] = c
end

local base = 0
do
  -- use 1 and others
  local tot1 = bls(1, n - 1)
  base = base + tot1
  for it = 0, tot1 - 1 do
    local dst = base + it
    bdp[dst] = edgesum[dst]
  end
end
local map_devide_or1, map_devide_or2 = {}, {}
for it = 0, 3^(n - 3) - 1 do
  local tmpit = it
  local a, b = 0, 0
  local mul = 1
  for j = 4, n do
    if tmpit % 3 == 2 then
      a = a + mul
    elseif tmpit % 3 == 1 then
      b = b + mul
    end
    mul = mul * 2
    tmpit = mfl(tmpit / 3)
  end
  map_devide_or1[it + 1], map_devide_or2[it + 1] = a, b
end
--use i
for i = 2, n do
  local totrem = 3^(n - i)
  local basei = 2^(n - i)
  for it = 0, totrem - 1 do
    local add_from_i = 0
    local marge_src = 0
    if i == 2 then
      if 2 * (3^(n - 3)) <= it then
        marge_src = marge_src + 2^(n - 3)
        it = it - 2 * (3^(n - 3))
      elseif 3^(n - 3) <= it then
        add_from_i = add_from_i + 2^(n - 3)
        it = it - (3^(n - 3))
      end
    end
    add_from_i = add_from_i + basei + map_devide_or1[it + 1]
    marge_src = marge_src + base + map_devide_or2[it + 1]
    local dst = bor(add_from_i, marge_src)
    bdp[dst] = mma(bdp[dst], bdp[marge_src] + edgesum[add_from_i])
  end
  base = base + basei
end
print(bdp[all - 1])
