#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a[101][101] = {};
	for(int y = 1; y <= n; y++) {
		for(int x = 1; x <= n; x++) cin >> a[y][x];
	}
	for(int y = 1; y <= n; y++) {
		for(int x = 1; x <= n; x++) a[y][x] += a[y][x-1];
	}
	for(int x = 1; x <= n; x++) {
		for(int y = 1; y <= n; y++) a[y][x] += a[y-1][x];
	}
	int ans = -10000*10000 - 1;
	for(int y1 = 1; y1 <= n; y1++) {
		for(int x1 = 1; x1 <= n; x1++) {
			for(int y2 = y1; y2 <= n; y2++) {
				for(int x2 = x1; x2 <= n; x2++) {
					int sum = a[y2][x2] - a[y2][x1-1] - a[y1-1][x2] + a[y1-1][x1-1];
					ans = max(sum, ans);
				}
			}
		}
	}
	cout << ans << endl;
}