#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
int a[101][101];
long long int h,maxx=0,tot=0;
cin>>h;
for(int i=1;i<=h;i++)
{
for(int j=1;j<=h;j++)
{
cin>>a[i][j];
}
}
for(int i=1;i<=h;i++)
{
for(int j=2;j<=h;j++)
{
a[i][j]+=a[i][j-1];
}
}
for(int x=1;x<=h;x++)
{
for(int x2=x;x2<=h;x2++)
{
//cout << "(" << x << "," << x2 << ")" << endl;
for(int i=1;i<=h;i++)
{
a[i][0]=0;
tot+=a[i][x2]-a[i][x-1];
//cout << "total : " << tot << endl;
if(tot>maxx)
{
maxx=tot;
}
if(tot<=0)
tot=0;
}
tot=0;
}
}
cout<<maxx<<"\n";
return 0;
}