import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    ss <- replicateM n getLine
    print . sum . map (\x -> comb (length x) 2) . group . sort $ map sort ss

comb n r | n < r = 0
         | otherwise = iterate (scanl1 (+)) [1, 1..] !! (n - r) !! r