import           Control.Monad
import           Data.List

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

nPr n r = (fact n) `div` fact (n-r)
nCr 1 r = 0
nCr 2 r = 1
nCr n r = (nPr n r) `div` fact r

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