let readString() = stdin.ReadLine()
let readStringArray() = stdin.ReadLine().Split(' ');
let readInt() = readString() |> int
let readIntArray() = readStringArray() |> Array.map(fun x -> int x)
let char2String(value) = List.ofSeq value |> List.toArray |> System.String

let n = readInt()
let h = readIntArray();

let judge index =
    let rec f i value =
        if i < 0 then 
            true
        else 
            if value >= h.[i] then f (i - 1) (max value h.[i]) else false
    f index h.[index]

let rec solve index =
    if index = n then 
        0 
    else
        if judge index then (solve (index + 1)) + 1 else solve (index + 1) 
    
            
solve 0
|> printfn "%d"