#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector< vector<int> > data(n, vector<int>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> data[i][j];
			if (j != 0) {
				data[i][j] += data[i][j-1];
			}
		}
	}
	int MAX = data[0][0];
	for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) {
			for (int k = 0; k < n; k++) {
				for (int l = k; l < n; l++) {
					int dd = 0;
					for (int m = k; m <= l; m++) {
						if (i == 0) {
							dd += data[m][j];
						} else {
							dd += data[m][j]-data[m][i-1];
						}
					}
					MAX = max(MAX, dd);
				}
			}
		}
	}
	cout << MAX << endl;
	return 0;
}