getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

main = do
  n <- getInt
  as <- getIntVec n

  h <- VM.new (n+1)
  VM.set h (0::Int)

  forM_ [0..(n-1)] $ \i -> do
    let a = as V.! i
    x <- VM.read h a
    VM.write h a (x+1)

  h' <- V.freeze h
  let csum = V.sum $ V.map (\x -> if x > 1 then x*(x-1)`div`2 else 0) h'

  forM_ [0..(n-1)] $ \i -> do
    let a = as V.! i
        x = h' V.! a
        c1 = if x > 1 then x*(x-1)`div`2 else 0
        c2 = if x > 2 then (x-1)*(x-2)`div`2 else 0
        ans = csum - c1 + c2
    print ans