module Main where
import qualified Data.Map as M
import Data.Hashable
import qualified Data.Vector as V
import Data.ByteString.Char8 as B

main = do
  n <- readLn
  xs <- V.replicateM n B.getLine
  let hashes = V.map (hash . B.sort) xs
  print $ sum [1 :: Int | i <- [0..n-1], j <- [i+1..n-1], hashes V.! i == hashes V.! j ]
