import Data.List
import Control.Monad

main :: IO ()
main = do
    n <- readLn :: IO Int
    ss <- sort . map sort <$> replicateM n getLine :: IO [String]
    print (sum $ map (s . length) $ group ss)

s :: Integral a => a -> a
s n = div (n * (n - 1)) 2