#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=a; i<b; ++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()

int n, a[110][110];
int sum[110][110];

void solve() {
	for_(i,0,n) {
		for_(j,0,n) {
			sum[i][j] = a[i][j];
			if (i > 0) sum[i][j] += sum[i - 1][j];
			if (j > 0) sum[i][j] += sum[i][j - 1];
			if (i > 0 && j > 0) sum[i][j] -= sum[i - 1][j - 1];
		}
	}
	
	int ans = (-1) * (int)1e9;
	for_(i,0,n) for_(j,0,n) {
		ans = max(ans, sum[i][j]);		
		
		for_(k,0,i + 1) for_(l,0,j + 1) {
			int sump = sum[i][j];
			if (k < i) sump -= sum[k][j];
			if (l < j) sump -= sum[i][l];
			if (k < i && l < j) sump += sum[k][l];
			ans = max(ans, sump);
		}
	}
	
	cout << ans << endl;
}

int main() {
	cin >> n;
	for_(i,0,n) for_(j,0,n) cin >> a[i][j];
	solve();
	return 0;
}