import Data.List
import Data.Char
import Data.Maybe
import Control.Monad
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.ByteString.Char8 as BS8

cntfw :: [T.Text] -> Int
cntfw s
    | length s <= 1 = 1
    | hs /= ss      = 1
    | otherwise     = 1 + (cntfw $ tail s)
    where
        hs = head s
        ss = s !! 1

sol s
    | length s <= 1 = 0
    | otherwise = ((cnt * (cnt-1)) `div` 2) + sol ds
    where
        hs  = head s
        cnt = cntfw s
        ds  = drop cnt s

main :: IO ()
main = do
    n <- fst . fromJust . BS8.readInt <$> BS8.getLine
    s <- sort <$> (replicateM n $ (T.pack).sort <$> getLine :: IO [T.Text])
    
    print $ sol s
