-- ABC 137 C
import Data.Maybe
import Data.Char
import Data.List
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as VU

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


readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

getInt :: IO Int
getInt = readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine