{- Author: Robin Nittka -}
module Main
	where

import System.IO
import Data.List

main = openFile "generate.in" ReadMode
		>>= hGetContents
		>>= putStr . unlines . map
				(show . length . group . sort . take 150 . iterate ((`mod` 10000) . (`div` 100) . (^2)) . read)
			. init . lines
