#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

double distanceAB(double xa, double ya, double xb, double yb);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	int n, sum[128][128], f[128][128];
	
	cin >> n;
	rep(i, n) rep(j, n)
	{
		cin >> f[i][j];
		sum[i+1][j] = sum[i][j] + f[i][j];
	}
	
	int ans = f[0][0];
	for (int si=0; si<n; si++)
	{
		for (int ti=si+1; ti<=n; ti++)
		{
			int l = 0, r = 0, s = 0;
			while (1 < n)
			{
				if (s < 0)
				{
					l = r;
					s = 0;
				} else if (r < n) {
					s += sum[ti][r] - sum[si][r];
					r++;
					ans = max(ans, s);
				} else {
					break;
				}
			}
		}
	}
	
	cout << ans << endl;
	
	return 0;
}



double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}