#include<iostream>

using namespace std;

int main() {
  int n, a[101][101], i, j, k, l, t, max;

  cin >> n;
  for(j = 0; j <= n; j++) a[0][j] = 0;
  for(i = 1; i <= n; i++) {
    a[i][0] = 0;
    for(j = 1; j <= n; j++) {
      cin >> t;
      a[i][j] = a[i-1][j]+a[i][j-1]-a[i-1][j-1]+t;
    }
  }
  max = a[1][1];
  for(i = 1; i <= n; i++)
    for(j = 1; j <= n; j++)
      for(k = 0; k < i; k++)
	for(l = 0; l < j; l++) {
	  t = a[i][j] - a[i][l] - a[k][j] + a[k][l];
	  if (t > max) max = t;
	}
  cout << max << endl;
  return 0;
}