#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 maxSumSeq(int* x, int len)
{
	int mss, s;
	mss = s = 0;
	for (int i = 0; i < len; i++) {
		s += x[i];
		if (s < 0) s = 0;
		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 i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++)
		{
			mat[i][j] += mat[i][j - 1];
		}
	}

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

	int maxSum = -2147483647;
	int sum = 0;
	for (int i1 = 0; i1 <= n; i1++) {
		for (int i2 = i1; i2 <= n; i2++) {
			for (int j1 = 0; j1 <= n; j1++) {
				for (int j2 = 0; j2 <= n; j2++) {
					sum = mat[i2][j2] - mat[i1][j2] - mat[i2][j1] + mat[i1][j1];
					if (maxSum < sum) maxSum = sum;
				}
			}
		}
	}
	cout << maxSum << endl;

	return;
}

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