#include <algorithm>
#include <iomanip>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

const int INF = 1001001001;

int main()
{
    int n;
    cin >> n;
    
    int sum[101][101] = {{}};
    rep(i, n) rep(j, n){
        int a;
        cin >> a;
        sum[i+1][j+1] = sum[i][j+1] + sum[i+1][j] - sum[i][j] + a;
    }
    
    int ans = -INF;
    rep(t, n) reps(b, t, n) rep(l, n) reps(r, l, n){
        ans = max(ans, sum[b+1][r+1] - sum[b+1][l] - sum[t][r+1] + sum[t][l]);
    }
    
    cout << ans << endl;
}