{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Text as T
import qualified Data.Text.IO as T

isRectangle :: [Int] -> Bool
isRectangle (a : b : c : _) = if (a * a + b * b == c * c) then True else False

isRhombus :: [Int] -> Bool
isRhombus (a : b : _ : _) = if (a == b) then True else False

textToInt :: T.Text -> Int
textToInt t = (read . T.unpack) t :: Int

countRR :: [[Int]] -> [Int]
countRR abcs = [res, rhs]
    where
        res = length $ filter (== True) $ map isRectangle $ abcs
        rhs = length $ filter (== True) $ map isRhombus $ abcs

main :: IO ()
main = putStr . unlines . map show . countRR . map (map textToInt) . map (T.splitOn ",") . T.lines =<< T.getContents