#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

ll a[100][100], dp[100][100];
signed main(void)
{
  int n;
  cin >> n;
  REP(i, n) REP(j, n) cin >> a[i][j];
  ll ret = -LLINF;
  REP(i, n) REP(j, n) FOR(k, i, n) FOR(l, j, n) {
    if(k == i && l == j) dp[k][l] = a[k][l];
    else if(k == i) dp[k][l] = dp[k][l-1] + a[k][l];
    else if(l == j) dp[k][l] = dp[k-1][l] + a[k][l];
    else dp[k][l] = dp[k-1][l] + dp[k][l-1] - dp[k-1][l-1] + a[k][l];
    ret = max(ret, dp[k][l]);
  }
  cout << ret << endl;
  return 0;
}