{-
Íàïèøèòå êîä, êîòîðûé íàõîäèò êîëè÷åñòâî ïîä÷èñåë ÷èñëà n, íà êîòîðûå ýòî ÷èñëî äåëèòñÿ áåç îñòàòêà.

Äëÿ ÷èñëà n, ïîä÷èñëî  ýòî òàêîå ÷èñëî, çàïèñü êîòîðîãî ÿâëÿåòñÿ ïîäñòðîêîé çàïèñè ÷èñëà n. Ê ïðèìåðó, åñëè n ðàâíÿåòñÿ 1938, òî åãî ïîä÷èñëàìè áóäóò ÿâëÿòüñÿ: 1, 9, 3, 8, 19, 93, 38, 193 è 938. Áåç îñòàòêà 1938 äåëèòñÿ íà ÷åòûðå èç ýòèõ ïîä÷èñåë: 1, 3, 19 è 38. Ñîîòâåòñòâåííî, ðåçóëüòàòîì ðàáîòû ïðîãðàììû äîëæíî áûòü ÷èñëî 4.
Åñëè ïîä÷èñëà ïîâòîðÿþòñÿ, êàæäîå èç íèõ ñ÷èòàåòñÿ. Íàïðèìåð, 101 äåëèòñÿ áåç îñòàòêà íà 1, 1 è 01, çíà÷èò, îòâåò  3.
-}

import Data.List

dividedBy :: Int -> String -> Bool
dividedBy _ [] = False
dividedBy n b = case read b of
					0 -> False
					x -> n `mod` x == 0 && n /= x


sublists :: String -> [String]
sublists [] = []
sublists s@(c:cs) = takeSub s (length s) ++ sublists cs
    where
        takeSub _ 0 = []
        takeSub s count = take count s : takeSub s (count - 1)

dividers :: Int -> Int
dividers n = length . filter (dividedBy n) . sublists . show $ n

main = putStrLn . show . dividers $ 1938