import java.util.Scanner

case class Input(as: List[Int]) {
  def heightMap = Input.heightMap(this.as)
  def heightRegions = this.heightMap.toList.sortWith({ case (a, b) => a._1 < b._1 })
  def solved: Output = {
    val n = as.length
    var hasSinked = Array.fill(n)(false)
    def updateSinked(regions: List[(Int, Int)]): Int = {
      var d = 0
      for ((from, to) <- regions) {
        var k = 1
        if ((from == 0) || hasSinked(from-1)) k -= 1
        if ((to == n-1) || hasSinked(to+1)) k -= 1
        d += k
        (from to to).foreach(hasSinked(_) = true)
      }
      d
    }
    var hr = this.heightRegions
    var m = 1
    if (hr.head._1 == 0) {
      m += updateSinked(hr.head._2)
      hr = hr.tail
    }
    var max = m
    for ((_, rs) <- hr) {
      val d = updateSinked(rs)
      m += d
      max = math.max(m, max)
    }
    Output(max)
  }
}

object Input {
  def mapAux(as: List[Int]): Map[Int, List[Int]] = {
    val m = scala.collection.mutable.Map[Int,List[Int]]()
      .withDefaultValue(List())
    as.zipWithIndex.foreach({ case (a, i) => m(a) = i :: m(a) })
    m.map({ case (a, l) => (a, l.reverse) }).toMap
  }
  def split(l: List[Int]): List[(Int, Int)] = {
    def aux(prev: Int, from: Int, acc: List[(Int, Int)], l: List[Int]): List[(Int, Int)] = l match {
      case Nil => (from, prev) :: acc
      case hd :: tl => if (prev+1 == hd) aux(hd, from, acc, tl)
                       else aux(hd, hd, (from, prev)::acc, tl)
    }
    aux(l.head-1, l.head, Nil, l).reverse
  }
  def heightMap(as: List[Int]): Map[Int, List[(Int, Int)]] = {
    val h2l = mapAux(as)
    h2l.map({ case (a, l) => (a -> split(l)) })
  }
  def fromStdin(): Input = {
    val sc = new Scanner(System.in)
    Input(List.fill(sc.nextInt())(sc.nextInt))
  }
}

case class Output(v: Int) {
  override def toString(): String = {
    v.toString()
  }

  def print() = println(this.toString())
}

object Main extends App {
  Input.fromStdin().solved.print()
}

