#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n; cin >> n;
	long long a[110][110] = {};
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			int k; cin >> k;
			a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + k;
		}
	}
	long long ans = -10000;
	for (int i = 1; i <= n; i++) {
		for (int j = i; j <= n; j++) {
			for (int k = 1; k <= n; k++) {
				for (int l = k; l <= n; l++) {
					ans = max(ans, a[j][l] - a[i - 1][l] - a[j][k - 1] + a[i - 1][k - 1]);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}
