#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#define INF 999999999

using namespace std;

int n;
int a[105][105];
int d[105][105];


int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			scanf("%d", &a[i][j]);
			if (i == 0) {
				d[i][j] = d[i][j - 1] + a[i][j];
			}
			else {
				d[i][j] = d[i - 1][j] - d[i - 1][j - 1] + d[i][j - 1] + a[i][j];
			}
		}
	}

	int max = -INF;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 0; k < i; k++) {
				for (int l = 0; l < j; l++) {
					int cur = d[i][j] - d[k][j] - d[i][l] + d[k][l];
					if (cur > max)max = cur;
				}
			}
		}
	}
	cout << max << endl;

	return 0;
}