#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<vector<int> > mat(n+1,vector<int>(n+1,0));
  for(int i=1; i<=n; i++)
	for(int j=1; j<=n; j++){
	  int k;
	  cin >> k;
	  mat[i][j] = k + mat[i-1][j] + mat[i][j-1] - mat[i-1][j-1];
	}
  int ret = 0x80000000;
  for(int x1=0; x1<n; x1++)
	for(int y1=0; y1<n; y1++)
	  for(int x2=1; x2<=n; x2++)
		for(int y2=1; y2<=n; y2++){
		  int t = mat[y2][x2] - mat[y2][x1] - mat[y1][x2] + mat[y1][x1];
		  ret = max(ret, t);
		}
  cout << ret << endl;
  return 0;
}