#include <iostream>
using namespace std;

long table[128][128];
static int M = 1;

int main(void) {
	int n;
	int ans = -1000000;
	int in[128][128];

	cin >> n;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			cin >> in[i][j];

	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			table[i + M][j + M] = table[i - 1 + M][j + M] + table[i + M][j - 1 + M] - table[i - 1 + M][j - 1 + M] + in[i][j];

	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++) {
					int tmp;
					tmp = table[k + M][l + M] - table[i - 1 + M][l + M] - table[k + M][j - 1 + M] + table[i - 1 + M][j - 1 + M];
					if(tmp > ans)
						ans = tmp;
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}