#include <iostream>

using namespace std;

int data1[101][101] = {};
int data2[101][101] = {};
int data3[101][101] = {};

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      cin >> data1[i][j];

  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      data3[i][j] = data2[i][j] =
          data1[i][j] + data2[i - 1][j] + data2[i][j - 1] - data2[i - 1][j - 1];

  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 0; k <= i; ++k) {
        for (int l = 0; l <= j; ++l) {
          int v;
          if (k == i && l == j)
            break;
          else if (k == i || l == j)
            v = data2[i][j] - data2[k][l];
          else
            v = data2[i][j] - data2[k][j] - data2[i][l] + data2[k][l];
          if (data3[i][j] < v)
            data3[i][j] = v;
        }
      }
    }
  }

  int maxv = data1[1][1];
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (maxv < data3[i][j])
        maxv = data3[i][j];

  cout << maxv << endl;
}
