let is_rect (x, y, z) = x * x + y * y = z * z
let is_loz (x, y, _)  = x = y
                              
let _ =
  let rn = ref 0 in
  let ln = ref 0 in
  try
    while true do
      let e = Scanf.scanf "%d,%d,%d\n" (fun x y z -> (x,y,z)) in
      if is_rect e then incr rn else if is_loz e then incr ln else ()
    done
  with
    End_of_file -> Printf.printf "%d\n" !rn; Printf.printf "%d\n" !ln