#include<stdlib.h>
#include<stdio.h>
#define N 10

int search(int left,int right, int top, int under, int max, int a[N][N] ,int n);

int main(int argc, const char * argv[])
{
	int n;
    
    scanf("%d", &n);
	int a[N][N]={0};
    
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            scanf("%d" ,&a[i][j]);
        }
    }
    /*-------------*/
    int max=-10001;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            int top=i;
            int under=i;
            int left=j;
            int right=j;
            int temp= -10001;
            temp = search(left, right, top, under, temp, a, n);
            if(temp>max){
                max=temp;
            }
            
            
        }
    }
    
    /*-------------*/
    printf("%d\n",max);
    
    
    
}

int search(int left,int right, int top, int under, int max, int a[N][N] ,int n){
    int temp=0;
    for (int i=top; i<=under; i++){
        for(int j=left; j<=right; j++){
            temp+= a[i][j];
        }
    }
    
    
    if(max<=temp){
        max=temp;
    }
    
    max = search(left, right, top, under+1, max, a,n);
    
    max = search(left, right+1, top, under, max, a,n);
    return max;
}