#include <bits/stdc++.h>   using namespace std;   const int maxN = 40;   int a[maxN][maxN];   int b[maxN][maxN];   int flips[maxN][maxN];   int n, x;   int check(int mask) {     memset(flips, 0, sizeof(flips));     for (int i = 0; i < x; ++i) {       if (mask & (1 << i)) {         flips[x - 1][i] = 1;       }     }     for (int i = 0; i + 1 < x; ++i) {       for (int j = 0; j < x; ++j) {         flips[i + x][j] = flips[i][j] ^ flips[x - 1][j];       }     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j + 1 < x; ++j) {         flips[i][j + x] = flips[i][j] ^ flips[i][x - 1];       }     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         b[i][j] = a[i][j];         if (flips[i][j]) {           b[i][j] = -b[i][j];         }       }     }     int res = 0;     for (int i = 0; i < n; ++i) {       res += b[x - 1][i];     }     for (int i = 0; i + 1 < x; ++i) {       for (int j = 0; j < n; ++j) {         b[i][j] += b[i + x][j];       }     }     for (int i = 0; i + 1 < x; ++i) {       int cres1 = 0, cres2 = 0;       for (int j = 0; j + 1 < x; ++j) {         cres1 += abs(b[i][j] + b[i][j + x]);         cres2 += abs(b[i][j] - b[i][j + x]);       }       res += max(cres1 + b[i][x - 1], cres2 - b[i][x - 1]);     }     return res;   }   int solve(vector<vector<int> > a) {     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         ::a[i][j] = a[i][j];       }     }     x = (n + 1) / 2;     int res = -1000000000LL;     for (int i = 0; i < (1 << x); ++i) {       res = max(res, check(i));     }     return res;   }   int main() {     scanf( %d , &n);     vector<vector<int> > a(n, vector<int>(n));     for (int i = 0; i < n; ++i) {       for (int j = 0; j < n; ++j) {         scanf( %d , &a[i][j]);       }     }     cout << solve(a) << endl;     return 0;   }   