#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1000000001
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
int main(){
      ll sum[100][100];
      int n,a;
      cin>>n;
      memset(sum,0,sizeof(sum));
      REP(i,n){
            REP(j,n){
                  cin>>sum[j][i];
            }
      }
      REP(i,n){
            REP(j,n){
                  if(i==0&&j==0)continue;
                  if(i!=0)sum[j][i]+=sum[j][i-1];
                  if(j!=0)sum[j][i]+=sum[j-1][i];
                  if(i!=0&&j!=0)sum[j][i]-=sum[j-1][i-1];
            }
      }
      ll ans=sum[0][0];
      REP(i,n)REP(j,n)REP(k,n)REP(l,n){
            if(k<i||l<j)continue;
            ll res=sum[l][k];
            if(i!=0)res-=sum[l][i-1];
            if(j!=0)res-=sum[j-1][k];
            if(i!=0&&j!=0)res+=sum[i-1][j-1];
            ans=max(res,ans);
      }

      cout<<ans<<endl;
}