import Data.List

isTriangular threeNumbers = x + y > z
  where
    [x, y, z] = sort threeNumbers

countTrue = length . filter id

parseInputLine = map (read :: String -> Integer) . words

toTriples l
  | length l < 3 = []
  | otherwise    = triple : toTriples rest
  where (triple, rest) = splitAt 3 l

main = do
  input <- getContents
  print . countTrue
        . map isTriangular
        . toTriples
        . concat
        . transpose
        . map parseInputLine
        . lines
        $ input

