import Control.Monad
import Data.List

solveSub :: [String] -> Int
solveSub [_] = 0
solveSub (x:y:z) | x == y = 1 + solveSub (x:z)
                 | otherwise = solveSub (x:z)

solve :: [String] -> Int
solve [_] = 0
solve xz@(x:z) = solveSub xz + solve z

main = do
    n <- readLn :: IO Int
    sn <- replicateM n (sort <$> getLine)
    print $ solve sn
