
import Data.List
import Control.Monad

foo :: [String] -> Int
foo = foldl (\acc x -> acc + (x-1)*x `div` 2) 0 . map length . group . sort . map sort

main = do
  num <- read <$> getLine :: IO Int
  ss  <- replicateM num getLine
  print $ foo ss

