//
//  main.cpp
//  Maximum Sum Sequence II
//
//  Created by 八代 光平 on 13/04/24.
//  Copyright (c) 2013年 八代 光平. All rights reserved.
//

#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++){
            int top=i;
            int under=i;
            int left=j;
            int right=j;
            int temp = search(top, under, left, right, a[top][left], a, n);
            //printf("%d\n",temp);
            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=temp;
            max=search(top, under+1, left, right, max, a, n);
        }
        
        int temp2 = sum(top, under, left, right+1, a);
        if(temp2>max /*&& right!=n*/){
            max=temp2;
            max=search(top, under, left, right+1, max, 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;
}