#include <iostream>
#include <climits>
using namespace std;

int n;
int a[100][100];
int b[5050][100];

int main() {
  int c, d, e, f, g, h;

  cin >> n;
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      cin >> a[i][j];
    }
  }

  for (int i=0; i<n; i++) {
    b[i][0] = a[i][0];
  }
  for (int i=0; i<n; i++) {
    for (int j=1; j<n; j++) {
      b[i][j] = b[i][j-1] + a[i][j];
    }
  }
  c = n;
  for (int i=1; i<n; i++) {
    d = n-i+1;
    for (int j=i; j<n; j++) {
      for (int k=0; k<n; k++) {
        b[c][k] = b[c-d][k] + b[j][k];
      }
      c++;
    }
  }

  h = -INT_MAX;
  e = (n*(n+1))/2;
  for (int i=0; i<e; i++) {
    f = g = 0;
    for (int j=0; j<n; j++) {
      if (b[i][j] < f) {
        f = g = b[i][j];
      } else if (b[i][j] > g) {
        g = b[i][j];
        if (g-f > h) {
          h = g-f;
        }
      }
    }
  }

  if (h < 0) {
    for (int i=0; i<n; i++) {
      for (int j=0; j<n; j++) {
        if (h < a[i][j]) {
          h = a[i][j];
        }
      }
    }
  }

  cout << h << endl;

  return 0;
}