#include<iostream>
#include<algorithm>
using namespace std;
#define INFTY (1 << 30)
int main(){
  int mas[101][101] = {{}}, n;
  cin >> n;
  for(int i = 1 ; i <= n ; i++ ){
    for(int j = 1 ; j <= n ; j++ ){
      cin >> mas[i][j];
      mas[i][j] += mas[i-1][j] + mas[i][j-1] - mas[i-1][j-1];
    }
  }
  int ret = -INFTY;
  for(int i = 1 ; i <= n ; i++ ){
    for(int j = 1 ; j <= n ; j++ ){
      for(int k = 1 ; k <= i ; k++ ){
        for(int l = 1 ; l <= j ; l++ ){
          ret = max( ret, mas[i][j] - mas[k-1][j] - mas[i][l-1] + mas[k-1][l-1]);
        }
      }
    }
  }
  cout << ret << endl;
}