#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <time.h>
#include <cstdio>
using namespace std;

int a[110][110];
int main(){
	int n;
	cin >> n;
	for(int i = 0 ; i < n ; i++){
		for(int j = 0 ; j < n ; j++){
			cin >> a[i+1][j+1];
		}
	}
	for(int i = 0 ; i <= n ; i++){
		for(int j = 1 ; j <= n ; j++){
			a[i][j] += a[i][j-1];
		}
	}
	for(int i = 1 ; i <= n ; i++){
		for(int j = 0 ; j <= n ; j++){
			a[i][j] += a[i-1][j];
		}
	}
	int ans = -2e9;
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= n ; j++){
			for(int k = 1 ; k <= n - i + 1 ; k++){
				for(int l = 1 ; l <= n - i + 1 ; l++){
					int sum = a[k+i-1][l+j-1] - a[k-1][l+j-1] - a[k+i-1][l-1] + a[k-1][l-1];
					//cout << i << " " << j << " " << k << " " << l << ": " << sum << endl;
					ans = max(ans,sum);
				}
			}
		}
	}
	cout << ans << endl;

}