#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>
using namespace std;

int a[100][100];

int main(){
  const int n = getInt();
  int ans = -1000000000;
  REP(i,n) REP(j,n){
    a[i][j] = getInt();
    if(i > 0) a[i][j] += a[i - 1][j];
    if(j > 0) a[i][j] += a[i][j - 1];
    if(i > 0 && j > 0) a[i][j] -= a[i - 1][j - 1];

    REP(ii,i + 1) REP(jj,j + 1){
      int t = a[i][j];
      if(ii > 0) t -= a[ii - 1][j];
      if(jj > 0) t -= a[i][jj - 1];
      if(ii > 0 && jj > 0) t += a[ii - 1][jj - 1];
      ans = max(ans, t);
    }
  }
  printf("%d\n", ans);
  return 0;
}