#include<iostream>
using namespace std;
int main(){
    int n;
    int a[100][100];
    int max = 0;
    cin >> n;
    for(int i = 0;i < n;i++)for(int j = 0;j < n;j++){
        cin >> a[i][j] ;
    }
    max = a[0][0];
    int s = 0;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            
            for(int I = i;I < n ;I++){
                s = 0;
                for(int J = j;J < n;J++){
                    for(int k = i;k < I + 1;k++){
                        s += a[k][J] ;
                        //cout << a[k][J] << endl;
                    } 
                //cout << " i " << i << " j  " << j << " I  " << I << " J  " << J << " s " << s << endl;
                if(s > max)max = s;  
                }
            }
        }
    }
    cout << max <<endl;
}
