#include <iostream>
#include <vector>
#include <string>

using namespace std;

vector<string> split(string s, string c) {
    vector<string> ret;
    for (int i = 0, n; i <= s.length(); i = n + 1) {
        n = s.find_first_of(c, i);
        if (n == string::npos) {
            n = s.length();
        }
        string tmp = s.substr(i, n - i);
        ret.push_back(tmp);
    }
    return ret;
}

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

    long data[n][n];

    for (int i = 0; i < n; i++) {
        string strRow = "";
        getline(cin, strRow);
        vector<string> row = split(strRow, " ");
        for (int j = 0; j < row.size(); j++) {
            data[i][j] = stoi(row[j]);
        }
    }

    long max = -1000000000000;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = i; k < n; k++) {
                for (int l = j; l < n; l++) {
                    long sum = 0;
                    for (int a = i; a <= k; a++) {
                        for (int b = j; b <= l; b++) {
                            sum += data[a][b];
                        }
                    }
                    max = sum > max ? sum : max;
                }
            }
        }
    }

     cout << max << endl;
}