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

int a[101][101];
int dp[101][101];

int main()
{
    int n;
    cin >> n;
    int ans = numeric_limits<int>::min();
    
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= n; ++j){
            cin >> a[i][j];
            dp[i][j] = a[i][j] + dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1];
        }
    }
    
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= n; ++j){
            for(int x = 1; x <= i; ++x){
                for(int y = 1; y <= j; ++y){
                    ans = max(ans, dp[i][j] - dp[i][x-1] - dp[y-1][j] + dp[y-1][x-1]);
                }
            }
        }
    }
    
    cout << ans << endl;
}