import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	auto n = readln.chomp.to!int;
	auto area = new int[][](n+1, n+1);
	foreach (i; 1..n+1) {
    auto tmp = readln.chomp.split.map!(to!int).array;
    foreach (j; 1..n+1) {
      area[i][j] = tmp[j-1] + area[i-1][j] + area[i][j-1] - area[i-1][j-1];
    }
  }

  auto res = int.min;
  foreach (i; 1..n+1) {
    foreach (j; 1..n+1) {
      foreach (k; 0..i) {
        foreach (l; 0..j) {
          res = max(res, area[i][j] - area[k][j] - area[i][l] + area[k][l]);
        }
      }
    }
  }

  res.writeln;
}