
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	ll a[105][105];
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	ll ans = 0;
	for (int ix = 0; ix < n; ix++) {
		for (int jx = ix; jx < n; jx++) {
			for (int iy = 0; iy < n; iy++) {
				for (int jy = 0; jy < n; jy++) {
					ll mem = 0;
					for (int i = ix; i <= jx; i++) {
						for (int j = iy; j <= jy; j++) {
							mem += a[i][j];
						}
					}
					ans = max(mem, ans);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}
