#include <iostream>
#include <algorithm>
using namespace std;


int n;
int mat[100][100];
int acc1[100][100];
int acc2[100][100];
int s = -999999999;


void accum1(){
	for (int y = 0; y < n; y++) acc1[y][0] = mat[y][0];
	for (int y = 0; y < n; y++)
		for (int x = 1; x < n; x++)
			acc1[y][x] = acc1[y][x - 1] + mat[y][x];
}


void accum2(){
	for (int x = 0; x < n; x++) acc2[0][x] = acc1[0][x];
	for (int y = 1; y < n; y++)
		for (int x = 0; x < n; x++)
			acc2[y][x] = acc2[y - 1][x] + acc1[y][x];
}


int getAccum(int xs, int ys, int xe, int ye){
	if (xs == 0 && ys == 0) return acc2[ye][xe];
	if (xs == 0) return acc2[ye][xe] - acc2[ys - 1][xe];
	if (ys == 0) return acc2[ye][xe] - acc2[ye][xs - 1];
	return acc2[ye][xe] - acc2[ye][xs - 1] - acc2[ys - 1][xe] + acc2[ys - 1][xs - 1];
}


void solve(){
	accum1();
	accum2();
	for (int ys = 0; ys < n; ys++){
		for (int xs = 0; xs < n; xs++){
			for (int ye = 0; ye < n; ye++){
				for (int xe = xs; xe < n; xe++){
					s = max(s, getAccum(xs, ys, xe, ye));
				}
			}
		}
	}
}


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

	solve();

	cout << s << endl;

	return 0;
}