import           Control.Monad
import           Data.List

fact :: Int -> Int
fact 0 = 1
fact n = n * fact (n - 1)

main = do
    n <- readLn :: IO Int
    s <- sort . map sort <$> replicateM n getLine :: IO [String]
    print . sum . map (\i -> (fact i) `div` 2) . map length $ group s
