
#include <iostream>
#include<stdlib.h>
#include<stdio.h>

int main(int argc, const char * argv[])
{
    int n=0;
    scanf("%d", &n);
    int a[n][n];
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            scanf("%d" ,&a[i][j]);
        }
    }
    
    
    int left = 0;
    int right= n-1;
    
    int top  = 0;
    int under= n-1;
    
    int check=1;
    
    while(check==1){
        int lsum=0;
        int rsum=0;
        int tsum=0;
        int usum=0;
        
        for(int i=left; i<=right; i++){
            tsum+=a[top][i];
            usum+=a[under][i];
        }
        for(int i=top; i<=under; i++){
            lsum+=a[i][left];
            rsum+=a[i][right];
        }
        
        if((tsum<0)||(usum<0)||(lsum<0)||(rsum<0)){
            int min = 0;
            int min_num = 0;
            if(min>tsum){
                min=tsum;
                min_num=0;
            }
            if(min>usum){
                min=usum;
                min_num=1;
            }
            if(min>lsum){
                min=lsum;
                min_num=2;
            }
            if(min>rsum){
                min=rsum;
                min_num=3;
            }
            if(min_num==0){
                top++;
            }
            if(min_num==1){
                under--;
            }
            if(min_num==2){
                left++;
            }
            if(min_num==3){
                right--;
            }

        }else if((tsum+lsum-a[top][left])<0){
            top++;
            left++;
        }else if((tsum+rsum-a[top][right])<0){
            top++;
            right--;
        }else if((usum+lsum-a[under][left])<0){
            under--;
            left++;
        }else if((usum+rsum-a[under][right])<0){
            under--;
            right--;
        /*-----------------*/
        }else if((tsum+lsum+rsum-a[top][left]-a[top][right])<0){
            top++;
            left++;
            right--;
        }else if((tsum+rsum+usum-a[top][right]-a[under][right])<0){
            top++;
            under--;
            right--;
        }else if((usum+lsum+rsum-a[under][left]-a[under][right])<0){
            under--;
            left++;
            right--;
        }else if((tsum+usum+lsum-a[under][left]-a[top][left])<0){
            top++;
            under--;
            left++;
        }else if((tsum+usum+lsum+rsum-a[under][left]-a[top][left]-a[under][right]-a[top][right])<0){
            top++;
            under--;
            right--;
            left++;
        }else{
            check =0;
        }

    }

    
    
    
 
    int temp =0;
        
        
    //std::cout << "\n";
    for(int i=top; i<=under; i++){
        for(int j=left; j<=right; j++){
            //printf( "%3d",a[i][j]);
            temp += a[i][j];
        }
        //std::cout << "\n";
    }
    printf( "%d\n",temp);
    
    
}