let get_max_profit lst =
    if List.length lst <= 1 then 0
    else
        let a1 = List.head lst
        let rest = List.tail lst

        let rec max_profit' lst result =
            match lst with
            | [] -> result
            | x::xs ->
                let next_result = 
                    if (x - a1) > result then x - a1
                    else result
                max_profit' xs next_result

        max_profit' rest 0

let solve a_lst =
    let rec solve' lst max_profit num_max =
        match lst with
        | [] -> num_max
        | x::xs ->
            let cur_mp = get_max_profit lst
            let next_mp, next_nm =
                if cur_mp < max_profit then (max_profit, num_max)
                elif cur_mp = max_profit then (max_profit, num_max + 1)
                else (cur_mp, 1)
            solve' xs next_mp next_nm
    solve' a_lst 0 0

let () =
    let _ = stdin.ReadLine ()
    let a_lst = stdin.ReadLine () |>
                (fun str -> str.Split()) |>
                Array.map int |> List.ofArray
    solve a_lst |> printfn "%d"