import Data.List
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)

getLines :: IO [String]
getLines = map (sort . BC.unpack) . BC.lines <$> BC.getContents

factorial :: Integer -> Integer
factorial 1 = 1
factorial n = n * factorial (n - 1)

combinations :: Integer -> Integer
combinations n
  | n <= 1 = 0
  | n == 2 = 1
  | otherwise = c `div` p
    where c = factorial n
          p = 2 * factorial (n - 2)

main :: IO ()
main = do
  getLine
  ls <- getLines
  print . sum . map (combinations . fromIntegral . length) . group $ sort ls
