#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>


using namespace std;
const int MOD = 1000000009; // check!!!
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())
#define ten(x) ((int)1e##x)
#define tenll(x) ((ll)1e##x)

int a[100][100];
int b[101][101];

int main(){

	int n; cin>>n;
	FOR(i,n) FOR(j,n) cin>>a[i][j];

	int ans = -10000;
	FOR(i,n){
		int s[101] = {};
		FOR(j,n) s[j+1] = s[j] + a[i][j];
		FOR(j,n) FOR(k,n){
			b[j][k] = max(0,b[j][k]) + s[k+1] - s[j];
			ans = max(ans,b[j][k]);
		}
	}

	cout << ans << endl;

	return 0;
}