

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define N 101

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

int main(int argc, const char * argv[])
{
    int n=0;
    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 = a[0][0];
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            for(int k=i; k<n; k++){
                for(int l=i; l<n; l++){
                    int temp=sum(i, k, j, l, a);
                    if(temp>max){
                        max=temp;
                    }
                                
//                int temp = sum(top, under, left, right, a);
//                temp = search(top, under, left, right, temp, a, n);
//                if(max<temp){
//                    max=temp;
//                }
                }
            }
            
        }
        
    }
    
    /*---------------*/
    printf("%d\n",max);
}

int search(int top, int under, int left, int right, int max, int a[N][N], int n){
    
    
    //    int temp = sum(top, under+1, left, right, a);
    //    if(temp>max && under!=n){
    //        max=search(top, under+1, left, right, temp, a, n);
    //    }
    //
        int temp2 = sum(top, under, left, right+1, a);
        if(temp2>max && right!=n){
            max=search(top, under, left, right+1, temp2, a, n);
        }
    
    return max;
    
}

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