import qualified Data.IntMap as M
import qualified Data.ByteString.Lazy.Char8 as B
import Data.List
import Debug.Trace
import Test.QuickCheck

main = do
  _ <- getLine
  input <- B.getContents
  let as = map readInt . B.words $ input
  print (solve as)

readInt :: B.ByteString -> Int
readInt s = case B.readInt s of Just (n,_) -> n

solve :: [Int] -> Int
solve xs =
  sum . map (comb 2) .  filter (>1) . map length . group . sort . scanl (+) 0 $ xs

comb k n = product[n-k+1..n]`div`product[1..k]
