#include <bits/stdc++.h>
using namespace std;

int n;
int a[200][200];

int sum(int x, int y, int X, int Y) {
  return a[y][x] - a[Y][x] - a[y][X] + a[Y][X];
}

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

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

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

  int ans = -1001001001;
  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) {
          ans = max(ans, sum(i, j, k, l));
        }
      }
    }
  }

  cout << ans << endl;
}