#include <iostream>

int main()
{
    int size_matrix;
    std::cin >> size_matrix;//???????????????????????????

    int data[100][100];
    int sum[100][100];

    for (int i = 0; i <=size_matrix; i++) {
        sum[0][i] = 0;///?£???????0????????????
        sum[i][0] = 0;
    }

    for (int line = 1; line <= size_matrix; line++) {//???
        for (int row = 1; row <= size_matrix; row++) {//???
            std::cin >> data[line][row];//????????????????????????
            sum[line][row] = sum[line][row -1] + sum[line -1][row] - sum[line - 1][row -1] + data[line][row];//sum?????´??°???????????°??£???????????¢????¶????????????????????????????

        }
    }

    int max = -10000;//??????????????????????°??????§?????????

    for (int line_big = 1;line_big <= size_matrix; line_big++) {
        for (int row_big = 1; row_big <= size_matrix; row_big++) {
            for (int line_small = 0; line_small < line_big; line_small++) {
                for (int row_small = 0; row_small < row_big; row_small++) {//????????¢???4?????±?????§?????????
                    int number = sum[line_big][row_big] -sum[line_big][row_small] - sum[line_small][row_big] + sum[line_small][row_small];
                    if (number > max) {//?????§?????´??°
                        max = number;
                    }
                }
            }
        }
    }

    std::cout << max << std::endl;

    return 0;
}