#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>

#define SIZE 100

using namespace std;
typedef long long int lint;

int mat[SIZE + 1][SIZE + 1] = { 0 };
int sum[SIZE + 1] = { 0 };

int maxSumSeq(int* x, int len)
{
	int mss, s;
	mss = s = x[0];
	for (int i = 1; i <= len; i++) {
		s = max(s + x[i], x[i]);
		if (mss < s) mss = s;
	}
	return mss;
}

void AOJ0098()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
		{
			cin >> mat[i][j];
		}
	}
	
	for (int j = 1; j <= n; j++) {
		for (int i = 1; i <= n; i++)
		{
			mat[i][j] += mat[i - 1][j];
		}
	}

	int maxSum = -2147483647;
	for (int i1 = 0; i1 < n; i1++) {
		for (int i2 = i1 + 1; i2 <= n; i2++) {
			for (int j = 0; j <= n; j++) {
				sum[j] = mat[i2][j] - mat[i1][j];
			}
			int mss = maxSumSeq(sum, n);
			if (maxSum < mss) maxSum = mss;
		}
	}

	cout << maxSum << endl;

	return;
}

int main()
{
	AOJ0098();
	return 0;
}