#include <iostream>
using namespace std;

#define N 100
#define MAX(X,Y) ((X)>(Y)?(X):(Y))

int main(void){
  long long ans, acc[N+1][N+1];
  int n;
  
  cin >> n;
  for (int i=0; i<=n; i++) acc[i][0] = acc[0][i] = 0;
  for (int i=0; i<n; i++){
    for (int j=0; j<n; j++){
      int t; cin >> t;
      acc[j+1][i+1] = t + acc[j][i+1] + acc[j+1][i] - acc[j][i];
    }
  }
  ans = -(1<<30);
  for (int xr=0; xr<n; xr++){
    for (int xl=0; xl<=xr; xl++){
      for (int yb=0; yb<n; yb++){
        for (int ya=0; ya<=yb; ya++){
          int sum;
          sum = acc[xr+1][yb+1] + acc[xl][ya]
            - acc[xl][yb+1] - acc[xr+1][ya];
          ans = MAX(ans, sum);
//          cout << "(" << xl << "," << ya << ") - ";
//          cout << "(" << xr << "," << yb << ") = " << sum << endl;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
