import java.util.Arrays;
import java.util.Scanner;
public class BOJ_14889 {
static int[][] s;
static int answer = Integer.MAX_VALUE;
static boolean[] startTeam;
static boolean[] linkTeam;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
s = new int[n][n];
startTeam = new boolean[n];
linkTeam = new boolean[n];
for (int i = 0; i < n; i++) {
s[i] = Arrays.stream(sc.nextLine().split("\\s")).mapToInt(Integer::parseInt).toArray();
}
solve(n, 0, 0, 0);
System.out.println(answer);
}
private static void solve(int n, int startCount, int linkCount, int index) {
if (startCount > n / 2 || linkCount > n / 2)
return;
if (startCount == n / 2 && linkCount == n / 2 && n == index) {
int startSum = 0;
int linkSum = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (startTeam[i] == true && startTeam[j] == true)
startSum += s[i][j];
if (linkTeam[i] == true && linkTeam[j] == true)
linkSum += s[i][j];
}
}
int temp = Math.abs(startSum - linkSum);
if (answer > temp)
answer = temp;
return;
}
startTeam[index] = true;
solve(n, startCount + 1, linkCount, index + 1);
startTeam[index] = false;
linkTeam[index] = true;
solve(n, startCount, linkCount + 1, index + 1);
linkTeam[index] = false;
}
}