#include <iostream>
#include <algorithm>
using namespace std;
int S[101][101];

int main(){
  int n;
  cin >> n;
  fill(S[0],S[101],0);
  for(int i = 1 ; i <= n ; i++ ){
    for(int j = 1 ; j <= n ; j++ ){
      int x;
      cin >> x;
      S[i][j] = S[i-1][j] + S[i][j-1] - S[i-1][j-1] + x;
    }
  }

  int mx = -99999999;
  for(int i = 1 ; i <= n ; i++ ){
    for(int j = 1 ; j <= n ; j++ ){
      for(int y = 1 ; y <= i ; y++ ){
	for(int x = 1 ; x <= j ; x++ ){
	  mx = max(mx,S[i][j] - S[y-1][j] - S[i][x-1] + S[y-1][x-1]);
	}
      }
    }
  }
  cout << mx << endl;
  return 0;
}