#include<iostream>
using namespace std;

int S[110][110] = { 0 }, a[110][110];


int main(){
	int n,max=-50000,t;
	cin >> n;
	for (int i = 0; i <= n; i++){
		S[0][i] = 0; S[i][0] = 0;
	}
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			cin >> a[i][j];
			S[i + 1][j + 1] = S[i][j + 1] + S[i + 1][j]-S[i][j]+a[i][j];
		}
	}
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			for (int k = 0; k < i; k++){
				for (int h = 0; h < j; h++){
					t = S[i][j] - S[k][j] - S[i][h] + S[k][h];
					if (max < t)max = t;
				}
			}
		}
	}
	cout << max << endl;
}