https://www.acmicpc.net/problem/14889
n=int(input())
scores=[list(map(int, input().split())) for _ in range(n)]
selects=[0]*(n//2)
ans=99999999
def check():
st, link=0, 0
another=[]
for i in range(n):
if i not in selects:
another.append(i)
for i in selects:
for j in selects:
st+=scores[i][j]
for i in another:
for j in another:
link+=scores[i][j]
return abs(st-link)
def back(index, start):
if index==(n//2):
global ans
ans=min(ans, check())
return
for i in range(start, n):
selects[index]=i
back(index+1, i+1)
back(0, 0)
print(ans)