#include <bits/stdc++.h>
int ans, n, a[40][40], x, c[40];
bool b[40];
int work(int st) {
  int res = 0;
  for (int i = 1, s = st; i <= x; ++i, s /= 2)
    res += a[i][x] * (c[i] = (b[i] = (s & 1)) ? -1 : 1);
  for (int i = 1; i < x; ++i) res += a[i + x][x] * ((b[i] ^ b[x]) ? -1 : 1);
  for (int i = 1; i < x; ++i) {
    int t1 = a[x][i] + a[x][i + x] * (b[x] ? -1 : 1), t2 = -t1;
    for (int j = 1; j < x; ++j)
      t1 += abs(a[j][i] + a[j][i + x] * (b[j] ? -1 : 1) + a[j + x][i] * (1) +
                a[j + x][i + x] * ((b[x] ^ b[j]) ? -1 : 1));
    for (int j = 1; j < x; ++j)
      t2 += abs(a[j][i] + a[j][i + x] * (b[j] ? -1 : 1) + a[j + x][i] * (-1) +
                a[j + x][i + x] * ((b[x] ^ b[j]) ? 1 : -1));
    res += std::max(t1, t2);
  }
  return res;
}
int main() {
  scanf("%d", &n);
  x = (n + 1) / 2;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) scanf("%d", &a[i][j]);
  for (int i = 0; i < (1 << x); ++i) ans = std::max(ans, work(i));
  printf("%d\n", ans);
}
