#include <iostream>

using namespace std;

int S[110][110];

int main(){
	int n,tmp,sum;
	cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			cin >> tmp;
			S[i+1][j+1] = S[i+1][j] + S[i][j+1] - S[i][j] + tmp;
		}
	}
	int max = S[1][1];
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			for(int k = 0; k < i; k++){
				for(int l = 0; l < j; l++){
					max = (max > S[i][j] - S[i][l] - S[k][j] + S[k][l]) ? max : S[i][j] - S[i][l] - S[k][j] + S[k][l];
				}
			}
		}
	}
	cout << max << endl;
}