x ? (a,b) = if x then a else b

readInt :: String -> Int
readInt = read

main = do
    s <- map readInt.tail.words<$>getContents
    print $ solve s

solve :: [Int] -> Int
solve = calc 0

calc i [] = 0
calc i (a:as) = (i>a)?(0,1) + calc (maximum[i,a]) as 
