#include<iostream>

using namespace std;

const int MAX = 101;

int S[MAX][MAX];
int M[MAX][MAX];
int n;

void input(){
  cin >> n;
  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= n; j++) cin >> M[i][j];
}

void solve(){

  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= n; j++)
      S[i][j] = S[i-1][j]+S[i][j-1]-S[i-1][j-1]+M[i][j];

  int ans = S[1][1];

  for(int i = 1; i <= n; i++)
    for(int j = 1; j <= n; j++)
      for(int k = i; k <= n; k++)
	for(int l = j; l <= n; l++)
	  ans = max(ans,S[k][l]-S[i-1][l]-S[k][j-1]+S[i-1][j-1]);

  cout << ans << endl;
}

int main(){
  input();
  solve();
  return 0;
}