import Data.List

solve :: [Int] -> Int
solve = sum . map ((\x -> x * (x - 1) `quot` 2) . length) . group . sort . scanl (+) 0

destruct :: [Int] -> [Int]
destruct (_:xs) = xs

main :: IO ()
main = print . solve . destruct . map read . words =<< getContents