parse :: String -> (Int , Int , Int)
parse xs = case break (== ',') xs of
    (y,ys) -> case break (== ',') (tail ys) of
        (z,zs) -> (read y , read z , read $ tail zs)

count :: (a -> Bool) -> [a] -> Integer
count f = foldr (\ x -> if f x then succ else id) 0

isRectangle :: (Int , Int , Int) -> Bool
isRectangle (x,y,z) = x ^ 2 + y ^ 2 == z ^ 2

isRhombus :: (Int , Int , Int) -> Bool
isRhombus (x,y,_) = x == y

solve :: [(Int , Int , Int)] -> IO ()
solve xs = print (count isRectangle xs) >> print (count isRhombus xs)

main :: IO ()
main = getContents
    >>= solve . map parse . lines