#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n;
    int imos[101][101];
    fill_n(*imos,101*101,0);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            int val;
            scanf("%d",&val);
            imos[i][j]=imos[i-1][j]+imos[i][j-1]-imos[i-1][j-1]+val;
        }
    }

    int ans=-1000000000;
    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++){
                    ans=max(ans,imos[i][j]-imos[y-1][j]-imos[i][x-1]+imos[y-1][x-1]);
                }
            }
        }
    }
    printf("%d\n",ans);
}