Note: Permuation, Combination 헷갈리지 말 것
from itertools import combinations
N = int(input())
S = [list(map(int,input().split())) for _ in range(N)]
N_list = [i for i in range(N)]
pairs = list(combinations(N_list,N//2))
min_gap = 10000
for i in range(len(pairs)//2):
team_a,team_b = pairs[i], pairs[-1-i]
stat_a = 0
for j in range(N//2):
for k in range(N//2):
stat_a += S[team_a[j]][team_a[k]]
stat_b = 0
for j in range(N//2):
for k in range(N//2):
stat_b += S[team_b[j]][team_b[k]]
stat_gap = abs(stat_a - stat_b)
if min_gap > stat_gap:
min_gap = stat_gap
print(min_gap)