#include <iostream>
#include <algorithm>
using namespace std;

int m[100][101];
int dp[101][100][100];

int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        m[i][0] = 0;
        for(int j = 1; j <= n; j++){
            cin >> m[i][j];
            m[i][j] += m[i][j-1];
        }
    }
    int max_v = -10000000;
    for(int i = 0; i < n; i++){
        for(int k = 0; k < n; k++){
            for(int j = 0; j <= k; j++){
                dp[i+1][j][k] = m[i][k+1] - m[i][j];
                dp[i+1][j][k] = max(dp[i+1][j][k],
                                    dp[i][j][k] + dp[i+1][j][k]);
                if( dp[i+1][j][k] > max_v ) max_v = dp[i+1][j][k];
            }
        }
    }
    cout << max_v << endl;
    return 0;
}