import scala.io.StdIn._
import scala.math._
object Main{
	def main(args: Array[String]): Unit = {
		lazy val n = readInt
		var map = Array.ofDim[Int](n + 1, n + 1)
		for(i <- 1 to n){
			  var temp = readLine.split(" ").map(_.toInt)
		    for(j <- 1 to n)map(i)(j) = map(i)(j - 1) + map(i - 1)(j) -  map(i - 1)(j - 1) + temp(j - 1)
		}
		var max = map(1)(1)
		for(i <- 1 to n ;j <- 1 to n;k <- i to n;l <- j to n){
		  var temp = map(k)(l)
		  temp += map(i - 1)(j - 1)
      temp -= map(i - 1)(l) 
		  temp -= map(k)(j - 1)
			max = math.max(max, temp)	
		}
		println(max)
  }
}