#include<algorithm>
#include<iostream>

int n;
int a[101][101];
int sum[101][101];

int main()
{
	std::cin >> n;
	for( int i = 1; i <= n; ++i )
		for( int j = 1; j <= n; ++j )
			std::cin >> a[i][j];

	for( int i = 1; i <= n; ++i )
		for( int j = 1; j <= n; ++j )
				sum[i][j] = sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + a[i][j];

	int ans = -( 1 << 30 );
	for( int i = 1; i <= n; ++i )
		for( int j = 1; j <= n; ++j )
			for( int k = 1; k <= i; ++k )
				for( int l = 1; l <= j; ++l )
					ans = std::max( ans, sum[i][j] - sum[i][l-1] - sum[k-1][j] + sum[k-1][l-1] );

	std::cout << ans << std::endl;

	return 0;
}