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

#define MX 105
#define INF 1e9

typedef long long ll;
int mat[MX][MX],sum[MX];

int main()
{
    #ifdef shibli
       //freopen("input.txt","r",stdin);
    #endif // shibli

    int n,x;
    cin>>n;

    int cur_sum,cur_max,f_max;
    cur_max = -INF;

    for(int i = 0; i < n; i++ )
    {
        for(int j = 0; j < n; j++ )
        {
           scanf("%d",&mat[i][j]);
           //cin>>mat[i][j];
           cur_max = max(cur_max, mat[i][j]);
        }
    }

    for(int i = 0; i < n; i++ )
    {
        memset(sum,0,sizeof(sum));

        for(int j = i; j < n; j++ )
        {
            cur_sum = 0;
            //cur_max = -INF;

            for(int k = 0; k < n; k++ )
            {
                sum[k] += mat[k][j];
                cur_sum = max( 0, cur_sum+sum[k]);
                if(cur_sum > 0) cur_max = max(cur_max, cur_sum);
                //cur_max = max(cur_sum,cur_max);
            }
           // f_max = max(f_max,cur_max);
        }
    }
        cout<<cur_max<<endl;
}

/* Most men die at 25 , We just don't bury them until they are 70 - Benjamin Franklin */