#include <cstdio>
#include <iostream>

using namespace std;

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

typedef long long int ll;

int main(){
    int n;
    cin >> n;
    int a[100][100] = {0};
    rep(i,n){
        rep(k,n){
            scanf("%d",&a[k][i]);
        }
    }

    ll width[100][100] = {0};
    rep(i,n){
        width[0][i] = a[0][i];
        reep(k,1,n){
            width[k][i] += width[k-1][i] + a[k][i];
        }
    }

    ll ans = 0;
    rep(lx,n){
        rep(ty,n){
            reep(rx,lx,n){
                reep(uy,ty,n){
                    ll cou=0;
                    reep(i,ty,uy+1){
                        if(lx==0){
                            cou += width[rx][i];
                        }else{
                            cou += width[rx][i] - width[lx-1][i];
                        }
                    }
                    ans = max(cou,ans);
                }
            }
        }
    }
    cout << ans << endl;
}