#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	while( cin >> n ){
		int ans = 0;
		vector< vector< vector< vector< int > > > > memo( n + 1, vector< vector< vector< int > > >( n + 1, vector< vector< int > >( n + 1, vector< int >( n + 1, 0 ) ) ) );
		for( int i = 1; i <= n; ++i ){
			for( int j = 1; j <= n; ++j ){
				cin >> memo[ i ][ j ][ i ][ j ];
			}
		}
		for( int i = 1; i <= n; ++i ){
			for( int j = 1; j <= n; ++j ){
				memo[ i ][ 1 ][ i ][ j ] = memo[ i ][ 1 ][ i ][ j - 1 ] + memo[ i ][ j ][ i ][ j ];
				memo[ 1 ][ 1 ][ i ][ j ] = memo[ 1 ][ 1 ][ i - 1 ][ j ] + memo[ i ][ 1 ][ i ][ j ];
			}
		}
		for( int by = 1; by <= n; ++by ){
			for( int ey = by; ey <= n; ++ey ){
				for( int bx = 1; bx <= n; ++bx ){
					for( int ex = bx; ex <= n; ++ex ){
						int a = memo[ 1 ][ 1 ][ ey ][ ex ];
						int b = memo[ 1 ][ 1 ][ by - 1 ][ ex ];
						int c = memo[ 1 ][ 1 ][ ey ][ bx - 1 ];
						int d = memo[ 1 ][ 1 ][ by - 1 ][ bx - 1 ];
						memo[ by ][ bx ][ ey ][ ex ] = a - b - c + d;
						ans = max( ans, memo[ by ][ bx ][ ey ][ ex ] );
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}