#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = j; i < (int)(k); ++i)
const int MAX_N  = 101;

int N, v[MAX_N][MAX_N], e[MAX_N][MAX_N];

int calc(int y1, int x1, int y2, int x2){
  int ret = e[y2][x2];
  if(x1 - 1 >= 0) ret -= e[y2][x1 - 1];
  if(y1 - 1 >= 0) ret -= e[y1 - 1][x2];
  if(x1 - 1 >= 0 && y1 - 1 >= 0) ret += e[y1 - 1][x1 - 1];
  return ret;
}

int main(){
  cin >>N;
  REP(i, N) REP(j, N) cin >>v[i][j];
  memset(e, 0, sizeof(e));
  e[0][0] = v[0][0];
  FOR(i, 1, N) e[i][0] = e[i - 1][0] + v[i][0];
  FOR(i, 1, N) e[0][i] = e[0][i - 1] + v[0][i];
  FOR(y, 1, N)
    FOR(x, 1, N)
      e[y][x] = v[y][x] + e[y - 1][x] + e[y][x - 1] - e[y - 1][x - 1];
  int ans = 0;
  REP(y1, N)
    REP(x1, N)
      FOR(y2, y1, N)
        FOR(x2, x1, N){
          //cout <<"y1 = " <<y1 <<", x1 = " <<x1 <<", y2 = " <<y2 <<", x2 = " <<x2 <<" | " <<calc(y1, x1, y2, x2) <<endl;
          ans = max(ans, calc(y1, x1, y2, x2));
        }
  cout <<ans <<endl;
  return 0;
}