#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999



int main(){
    int n;
    cin>>n;
    int data[200][200];
    rep(i,n)rep(j,n){
        cin>>data[i][j];
    }
    
    int maxi = -1000000000;
    rep(i,n){
        rep(j,n){
            int dp[200][200]={};
            for(int k=i;k<n;k++){
                for(int l=j;l<n;l++){
                    dp[k][l] = (k-1>=i)*dp[k-1][l] + (l-1>=j)*dp[k][l-1] - (k-1>=i&&l-1>=j)*dp[k-1][l-1] + data[k][l];

                    maxi = max(maxi,dp[k][l]);
                }
            }
        }
    }
    cout<<maxi<<endl;
}