
#include <iostream>
using namespace std;

int a[102][102];
int dp[102][102];

inline int area(int y1, int x1, int y2, int x2){
	int ret = dp[y2][x2];
	if(y1 - 1 >= 0)ret -= dp[y1-1][x2];
	if(x1 - 1 >= 0)ret -= dp[y2][x1-1];
	if(y1 - 1 >= 0 && x1 - 1 >= 0)ret += dp[y1-1][x1-1];
	return ret;
}
int main(){
	int n;
	cin >> n;

	for(int i=0;i<n;i++)for(int j=0;j<n;j++){
		cin >> a[i][j];
	}

	dp[0][0] = a[0][0];

	for(int i=1;i<n;i++){
		dp[i][0] = dp[i-1][0] + a[i][0];
	}
	for(int j=1;j<n;j++){
		dp[0][j] = dp[0][j-1] + a[0][j];
	}

	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] - dp[i-1][j-1] + a[i][j];
		}
	}

	int ret = -(1 << 30);
	for(int y1=0;y1<n;y1++)for(int x1=0;x1<n;x1++){
		for(int y2=y1;y2<n;y2++)for(int x2=x1;x2<n;x2++){
			int tmp = area(y1, x1, y2, x2);
			ret = max(ret, tmp);
		}
	}


	cout << ret << endl;

	return 0;
}