#include <bits/stdc++.h>
#define llong long long
using namespace std;
const int give_long=120+10;
int n;
llong answer=LLONG_MIN;
int a[give_long][give_long],s[give_long][give_long];
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
{
cin>>a[i][j];
s[i][j]=s[i-1][j]+s[i][j-1]
+a[i][j]-s[i-1][j-1];
}
for(int x=1;x<=n;x++)
for(int y=1;y<=n;y++)
for(int xx=1;xx<=n;xx++)
for(int yy=1;yy<=n;yy++)
{
llong anser=s[xx][yy]-
s[xx][y-1]-s[x-1][yy]
+s[x-1][y-1];
if(answer<anser)
answer=anser;
}
cout<<answer<<"\n";
return 0;
}