import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.IntMap.Strict as M
import Data.List
import Control.Monad

readInput :: IO [Int]
readInput = map (either error fst . T.decimal) . T.words <$> T.getLine

main = do
  count <- readLn
  xs <- readInput
  let nums = M.fromList $ zip [1..] xs
  let counts = M.fromListWith (+) [ (i, 1) | i <- xs ]
  let totals = M.map (\n -> if n < 2 then 0 else n * (n - 1)) counts
  let grand = foldl' (+) 0 totals
  forM_ [1..count] $ \i -> do
    print $ max 0 $ div grand 2 - counts M.! (nums M.! i) + 1
