import Control.Monad
import Data.List
import qualified Data.Map.Strict as M

main=do
    s <- getLine
    print.(+) 1.(-) (comb2 $ length s).sum.map (comb2.snd).M.toList $ foldl (\m k->M.insertWith(+)k 1 m) M.empty s

comb2 n = (n*(n-1)) `div` 2