#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<numeric>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int i,j,k,l;
  int n;
  cin>>n;
  int a[101][101]={};
  for(i=0;i<n;++i){
    for(j=0;j<n;++j){
      cin>>a[j+1][i+1];
      a[j+1][i+1]+=a[j][i+1]+a[j+1][i]-a[j][i];
    }
  }
  int mx=-100000000;
  for(i=1;i<=n;++i)
    for(j=1;j<=n;++j)
      for(k=0;k<n-i+1;++k)
        for(l=0;l<n-j+1;++l)
          mx=max(mx,a[i+k][j+l]-a[k][j+l]-a[i+k][l]+a[k][l]);
  cout<<mx<<endl;
  return 0;
}