
import Control.Monad
import qualified Data.IntMap as IntMap
import Data.Time
--import Data.Array.IO
import qualified Data.Vector.Unboxed as V
import Data.Maybe

{-toIntMap :: Int -> Int -> [Int] -> IntMap.IntMap Int
toIntMap i k [] = IntMap.empty
toIntMap i k (x:xs) | i == k = (toIntMap (i+1) k xs)
                    | otherwise = IntMap.insertWith (+) x 1 (toIntMap (i+1) k xs)-}

{-toIntMap :: Int -> Int -> V.Vector Int -> IntMap.IntMap Int
toIntMap i k v | V.null v = IntMap.empty
               | i == k = (toIntMap (i+1) k (V.tail v))
               | otherwise = IntMap.insertWith (+) (V.head v) 1 (toIntMap (i+1) k (V.tail v))-}

toIntMap :: V.Vector Int -> IntMap.IntMap Int
toIntMap v | V.null v = IntMap.empty
           | otherwise = IntMap.insertWith (+) (V.head v) 1 (toIntMap (V.tail v))



main = do
  --let n = 100000  -- n=2000   ->  1.6s
  --let as = replicate n 1
  n <- read<$>getLine
  as <- (map read) . words<$>getLine :: IO [Int]
  --preJikkou <- getCurrentTime
  let as_v = V.fromList as
  let whole = toIntMap as_v
  let f v = v * (v-1) `div` 2
  let whole_value = IntMap.foldl (+) 0 $ IntMap.map f whole

  V.forM_ (V.generate n id) $ \k -> do
    --let excpt = (take k as) ++ (drop (k+1) as)
    print $ whole_value - ((fromMaybe 0 (IntMap.lookup (as_v V.! k) whole)) - 1)

  --postJikkou <- getCurrentTime
  --print $ diffUTCTime postJikkou preJikkou