#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

auto kadane(vector<int> ary)
{
    int max_global = ary[0], max_current = ary[0];
    for (int i = 1; i < ary.size(); i++)
    {
        max_current = max(ary[i], max_current + ary[i]);
        max_global = max(max_global, max_current);
    }
    return max_global;
}

vector<int> a[100];

int main()
{
    int n;
    cin >> n;
    rep(i, n) rep(j, n)
    {
        int m;
        cin >> m;
        a[i].push_back(m);
    }
    int maxv = INT_MIN;

    rep(i, n)
    {
        vector<int> st(n, 0);

        for (int j = i; j < n; j++)
        {
            rep(k, n) st[k] += a[j][k];
            maxv = max(maxv, kadane(st));
        }
    }

    OP(maxv);

    return 0;
}
