import Data.List(sort)
import Control.Monad(replicateM)

comb :: [String] -> [(String, String)]
comb [] = []
comb (x:xs) = map ((,) x) xs ++ comb xs

main = do
    n <- readLn :: IO Int
    ss <- replicateM n getLine :: IO [String]
    print $ length $ filter (==True) [sort s1 == sort s2 | (s1,s2)<- (comb ss)]