import scala.annotation.tailrec
object Main extends App {
  import scala.io.StdIn._


  val n = readInt
  val a = Array.tabulate(n){_ ⇒ readLine.trim.toInt}
  println(
    math.max(calMaxDecrease(a), calMaxIncrease(a))
  )
  def calMaxIncrease(a: Array[Int]): Int = {
    @tailrec
    def sub(a: Array[Int], pos: Int = 0, prev: Int = -1, length: Int = 0, maxLength: Int = 0): Int = {
      if (a.length == pos) math.max(length, maxLength)
      else if (a(pos) > prev) sub(a, pos + 1, a(pos), length + 1, maxLength)
      else if (a(pos) == prev) sub(a, pos + 1, prev, length, maxLength)
      else sub(a, pos, -1, 0, math.max(length, maxLength))
    }
    sub(a)
  }
  def calMaxDecrease(a: Array[Int]): Int = {
    @tailrec
    def sub(a: Array[Int], pos: Int = 0, prev: Int = Int.MaxValue, length: Int = 0, maxLength: Int = 0): Int = {
      if (a.length == pos) math.max(length, maxLength)
      else if (a(pos) < prev) sub(a, pos + 1, a(pos), length + 1, maxLength)
      else if (a(pos) == prev) sub(a, pos + 1, prev, length, maxLength)
      else sub(a, pos, Int.MaxValue, 0, math.max(length, maxLength))
    }
    sub(a)
  }
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def let[A](func: T ⇒ A): A = func(value)
    @inline
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}
