import Data.List

main :: IO ()
main = do 
    input <- readFile "input.txt"
    print . count . average . map read $ words input

average :: [Int] -> [Int]
average (x:y:[]) = []
average (x:y:z:xs) = x+y+z:average (y:z:xs)

count :: [Int] -> Int
count (x:xs) = count_f x xs

count_f :: Int -> [Int] -> Int
count_f _ [] = 0
count_f nb (x:xs)
     | x > nb = 1 + count_f x xs
     | otherwise = count_f x xs

