#include <iostream>
#include <cstdio>
#include <cstring>
#include <climits>

using namespace std;

#define MN 100
#define INF INT_MIN

int n;
int F[MN][MN];
int L[MN][MN][MN];

int calc(int sy, int sx, int gy, int gx) {
    int ret = 0;
    for (int i = sy; i < gy; i++) {
        ret += L[i][sx][gx];
    }
    return ret;
}

int main() {
    while (cin >> n) {
        memset(F, 0, sizeof(F));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                cin >> F[i][j];
            }
        }
        memset(L, 0, sizeof(L));
        for (int i = 0; i < MN; i++) {
            for (int j = 0; j < MN; j++) {
                for (int k = j+1; k <= MN; k++) {
                    L[i][j][k] = L[i][j][k-1] + F[i][k-1];
                }
            }
        }
        int ans = INF;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                for (int k = i+1; k <= n; k++) {
                    for (int l = j+1; l <= n; l++) {
                        ans = max(ans, calc(i, j, k, l));
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}