module Main where

import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as BS
comb [] = 0
comb (x:xs) = length (filter (==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 $ comb xs