#include <iostream>
using namespace std;

int main(){
	int n;
	int sum[101][101] = {};
	cin >> n;
	int ma = -1000000000;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= n;j++){
			cin >> sum[i][j];
			sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = i;j <= n;j++){
			for(int k = 1;k <= n;k++){
				for(int l = k;l <= n;l++){
					ma = max(ma,sum[j][l] - sum[i - 1][l] - sum[j][k - 1] + sum[i - 1][k - 1]);
				}
			}
		}
	}
	cout << ma << endl;
	return 0;
}