main = do
  _ <- getLine
  xs <- fmap (fmap read . words) . lines <$> getContents :: IO [[Int]]
  print . (`div` 2) . length $ filter (`elem` [x^2 | x <- [1..100]]) [sum . fmap (\(y, z) -> (y - z)^2) $ zip ys zs | ys <- xs, zs <- xs, ys /= zs]
