#include <iostream>
#include <string>
#include <vector>
using namespace std;

int mat[110][110];
long long sum[110][110];

int main() {
    int n;
    cin >> n;
    for (int i=1; i<=n; ++i) {
        for (int j=1; j<=n; ++j) {
            cin >> mat[i][j];
        }
    }
    for (int i=0; i<=n; ++i) {
        for (int j=0; j<=n; ++j) {
            if (i == 0 || j == 0) {
                sum[i][j] = 0;
            } else {
                sum[i][j] = sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + mat[i][j];
            }
        }
    }
    long long mx = 0;
    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) {
                    long long area = sum[k][l] - sum[i-1][l] - sum[k][j-1] + sum[i-1][j-1];
                    mx = max(mx, area);
                }
            }
        }
    }
    cout << mx << endl;
    return 0;
}