loop :: Int -> [Int] -> Int -> Int loop _ [] acc = acc loop prev (curr:rest) acc | prev < curr = loop curr rest (acc + 1) | otherwise = loop curr rest acc main = interact $ solution . getInput where solution input = show $ loop (head input) (tail input) 0 getInput = map read . words