
object Main extends App {

  import scala.io.StdIn._
  val n = readLine.trim.toInt
  println(
    countMaxLength(readLine.trim.split(' ').map(_.toInt).toList) + 1
  )
  def countMaxLength(cell: List[Int], count: Int = 0, max: Int = 0): Int = {
    cell match{
      case Nil ⇒ if (count > max) count else max
      case 1::t ⇒ countMaxLength(t, count + 1, max)
      case 0::t ⇒ if (count > max) countMaxLength(t, 0, count) else countMaxLength(t, 0, max)
      case _ ⇒ throw new Exception
    }
  }
}

