#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
const int N = 3e2 + 5;
const int MOD = 1e9 + 7;
const int INF = 2e9;
const int dr4[] = {1, -1, 0, 0};
const int dc4[] = {0, 0, 1, -1};
const int dr8[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dc8[] = {0, 1, 1, 1, 0, -1, -1, -1};
int n;
int a[N][N];
int dp[N][N][N];
int f(int r1, int r2, int diag) {
  if (diag >= n * 2) return 0;
  int c1 = diag + 1 - r1;
  int c2 = diag + 1 - r2;
  if (r1 > n || c1 > n || r2 > n || c2 > n) return -INF;
  int &sol = dp[r1][r2][diag];
  if (sol != -1) return sol;
  int val = a[r1][c1] + (r1 == r2 ? 0 : a[r2][c2]);
  return sol =
             val + max({f(r1, r2, diag + 1), f(r1 + 1, r2, diag + 1),
                        f(r1, r2 + 1, diag + 1), f(r1 + 1, r2 + 1, diag + 1)});
}
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  memset(dp, -1, sizeof(dp));
  cout << f(1, 1, 1) << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  for (int tc = 1; tc <= T; tc++) {
    solve();
  }
}
