import Control.Monad
import Data.List

main :: IO ()
main = do
  n <- readLn
  ss <- replicateM n getLine
  let s = map length $ group . sort $ map sort ss
  let s2 = map (\x -> x * (x - 1) `div` 2) s
  print $ sum s2
