import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;


void main() {
	int n = to!int(readln().strip());
	int[][] a = new int[][](n,n);
	for(int i; i < n; ++i){
		auto s = readln().strip().split();
		for(int j; j < n; ++j) {
			a[i][j] = to!int(s[j]);
		}
	}
	int dp[][] = new int[][](n+1,n+1);
	dp[0][0] = a[0][0];
	for(int i = 1; i <= n; ++i){
		for(int j = 1; j <= n; ++j) {
			dp[i][j] = dp[i-1][j] + dp[i][j-1] + a[i-1][j-1] - dp[i-1][j-1];
		}
	}
	int ans = int.min;
	for(int i; i < n; ++i) {
		for(int j; j < n; ++j) {
			for(int k = i+1; k <= n; ++k) {
				for(int l = j+1; l <= n; ++l) {
					ans = max(ans, dp[k][l] - dp[k][j] - dp[i][l] + dp[i][j]);
				}
			}
		}
	}
	writeln(ans);
}