import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (sort, group)

main :: IO ()
main = do
  n <- unsafeSignedDecimal <$> T.getLine :: IO Int
  ss <- sequence . replicate n $ getLine :: IO [String]
  print . sum . map (count . length) . group . sort . map sort $ ss

count :: Int -> Int
count k = (k * (k - 1)) `div` 2

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
