#include <iostream>

using namespace std;

int dp[101][101];

int main() {
    int n;
    cin >> n;

    for (int y = 0; y < n; y++) {
        for (int x = 0; x < n; x++) {
            int v;
            cin >> v;
            dp[y + 1][x + 1] = dp[y + 1][x] + dp[y][x + 1] - dp[y][x] + v;
        }
    }

    int answer = -10000;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= n; k++) {
                for (int l = 1; l <= n; l++) {
                    answer = max(answer, dp[i][j] - dp[k - 1][j] - dp[i][l - 1] + dp[k - 1][l - 1]);
                }
            }
        }
    }

    cout << answer << endl;

    return 0;
}