main = interact $ unlines . map show . plastic_board . map (map read . splitOn ',') . lines

splitOn c xs
 | null xs = []
 | head xs == c = splitOn c (tail xs)
 | otherwise = (takeWhile (/= c)) xs : splitOn c (dropWhile (/= c) xs)

plastic_board ds = [rects,diamonds]
 where
  rects = length $ filter (\[a,b,c] -> a^2+b^2 == c^2) ds
  diamonds = length $ filter (\[a,b,_] -> a == b) ds