import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    immutable n = readln().chomp().to!int();
    auto a = iota(n).map!(_=>readln().split().map!(to!int).array()).array();
    int idx(int i, int j){ return i*(n+1)+j; }
    auto s = new int[(n+1)^^2];
    foreach(i;0..n)
        foreach(j;0..n)
            s[idx(i+1,j+1)] = s[idx(i+1,j)]+s[idx(i,j+1)]-s[idx(i,j)]+a[i][j];
    int m=int.min;
    foreach(i1;0..n) foreach(i2;i1+1..n+1)
        foreach(j1;0..n) foreach(j2;j1+1..n+1)
            m=max(m,s[idx(i2,j2)]-s[idx(i2,j1)]-s[idx(i1,j2)]+s[idx(i1,j1)]);
    writeln(m);
}