import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readString = map BS.unpack . BS.words

getInt = readInt <$> BS.getLine

getNString n = concat . map readString <$> replicateM n BS.getLine

countS :: String -> [String] -> Integer -> [String] -> (Integer, [String])
countS s' [] n ts = (n, ts)
countS s' (s : ss) n ts
  | s' == s = countS s' ss (n + 1) ts
  | otherwise = countS s' ss n (s : ts)

getS :: [String] -> Integer
getS [] = 0
getS (s : ss) = n + getS ts
  where
    (k, ts) = countS s ss 0 []
    n = (k * (k + 1)) `div` 2

main = do
  n <- getInt
  ss <- getNString n
  let ss' = map (\x -> sort x) ss
  print $ getS ss'
