import Data.List as L
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)

readInts2 :: IO [[Int]]
readInts2 = map (map (fst . fromJust . BC.readInt) . BC.words) . BC.lines <$> BC.getContents

isInt :: (RealFrac a) => a -> Bool
isInt x = x == fromInteger (round x)

main :: IO ()
main = do
  getLine
  xss <- readInts2
  let calc x y = sqrt . fromIntegral . sum $ zipWith (\a b -> (a - b) ^ 2) x y
  let distances = [calc x y | (x:rest) <- L.tails xss, y <- rest]
  print . length $ filter (== True) $ map isInt distances