#include <algorithm>
#include <cstdio>

static const size_t n_max = 100;
static int dp[n_max+1][n_max+1];

int main() {
  size_t n;
  scanf("%zu\n", &n);
  for (size_t j = 1; j <= n; j++)
    for (size_t i = 1; i <= n; i++) {
      int a;
      scanf("%d", &a);
      dp[j][i] = a + dp[j][i-1] + dp[j-1][i] - dp[j-1][i-1];
    }
  int r = dp[1][1];
  for (size_t j = 1; j <= n; j++)
    for (size_t i = 1; i <= n; i++)
      for (size_t l = 0; l < j; l++)
        for (size_t k = 0; k < i; k++)
          r = std::max(r, dp[j][i] + dp[l][k] - dp[j][k] - dp[l][i]);
  printf("%d\n", r);
  return 0;
}