import Control.Monad
import Data.List

main = do
  li <- getLine
  let n = read li :: Int
  ss <- sequence $ replicate n getLine
  let ans = compute ss
  print ans

compute :: [String] -> Int
compute ss = sum $ map (f.length) $ group $ sort $ map sort ss
  where
    f n = (n-1) * n `div` 2
