#include <iostream>
using namespace std;
const int N = 110;
int g[N][N], s[N][N];
int res = -130;
int main(){
    int n;
    cin>>n;
    for(int i = 1; i <= n; i ++)
        for(int j = 1; j <= n; j ++){
            scanf("%d", &g[i][j]);
            s[i][j] = s[i-1][j] + s[i][j-1] - s[i-1][j-1] + g[i][j];
        
        }
        
    for(int x1 = 1; x1 <= n; x1 ++)
        for(int y1 = 1; y1 <= n; y1 ++)
            for(int x2 = x1; x2 <= n; x2 ++)
                for(int y2 = y1; y2 <= n; y2 ++){
                    int tmp = s[x2][y2] - s[x1 - 1][y2] - s[x2][y1 - 1] + s[x1 - 1][y1 - 1];
                    res = max(res, tmp);
                }
    cout<<res<<endl;
    return 0;
}