module Main where

import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as BS
comb [] = []
comb (x:xs) = map ((,)x) xs ++ comb xs
    

main :: IO ()
main = do
    n <- readLn 
    xs <- replicateM n (BS.sort <$>BS.getLine)
    --[a,b]<-map (fst . fromJust . BS.readInt) . BS.words <$>BS.getLine
    print $length $ filter (==True)$map (\(x,y)->x==y)$comb xs