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

int s[100][100][100] = {};

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