

class UnionFind(val size: Int) {
    private val vec = IntArray(size){-1}
    fun find(a: Int): Int {
        return if (vec[a] < 0) a else find(vec[a]).also{vec[a] = it}
    }
    fun same(a: Int, b: Int): Boolean {
        return find(a) == find(b)
    }
    fun unite(a: Int, b: Int): Unit {
        val ar = find(a)
        val br = find(b)
        if (ar == br) return
        if (vec[ar] < vec[br]) {
            vec[ar] += vec[br]
            vec[br] = ar
        }else {
            vec[br] += vec[ar]
            vec[ar] = br
        }
    }
}

fun main(args: Array<String>?) {
    val n = readLine()!!.toInt()
    val values = readLine()!!.trim().split(' ').map(String::toInt) + 0
    val sorted = values.indices.sortedByDescending(values::get)
    val uft = UnionFind(n)
    var prev = -1
    var current = 0
    var max = 0
    for (i in sorted) {
        if (prev != values[i])
            max = java.lang.Math.max(max, current)
        if (values[i] == 0) break
        ++current
        if (i - 1 >= 0 && values[i - 1] >= values[i] && !uft.same(i, i - 1)) {
            --current
            uft.unite(i, i - 1)
        }
        if (i + 1 < n && values[i + 1] >= values[i] && !uft.same(i, i + 1)) {
            --current
            uft.unite(i, i + 1)
        }
        prev = values[i]
    }
    println(max)
}
