#include<bits/stdc++.h>
using namespace std;

#define rep(i, n)     for(int i=0; i<n; i++)
#define rrep(i, m, n) for(int i=m; i<n; i++)

int n;
int dp[111][111];

int main()
{
  cin >> n;
  rrep(i, 1, n + 1) rrep(j, 1, n + 1) cin >> dp[i][j];

  rrep(i, 1, n + 1) rrep(j, 1, n) dp[i][j + 1] += dp[i][j];
  rrep(i, 1, n) rrep(j, 1, n + 1) dp[i + 1][j] += dp[i][j];

  int res = -11111;
  rrep(tx, 1, n + 1) rrep(ty, 1, n + 1) rep(sx, tx) rep(sy, ty) res = max(res, dp[tx][ty] - dp[tx][sy] - dp[sx][ty] + dp[sx][sy]);

  cout << res << endl;

  return 0;
}