
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Data.List
import Control.Monad
import Data.Foldable
import Data.Char
import qualified Data.IntMap.Strict as IM

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine


main :: IO ()
main = do
    n <- readLn :: IO Int
    as <- r'
    let av = U.fromList as
    let ocMap = IM.fromListWith (+) (map (\x->(x,1)) as)
    forM_ [0..n-1] (\m ->
            print $ solve (av U.! m) ocMap
        )


solve :: IM.Key -> IM.IntMap Int -> Int
solve idx ocs = IM.foldr' (\a b -> f a + b) 0 (IM.adjust ss idx ocs)

ss :: Int -> Int
ss x = max 0 (x-1)

f :: Int -> Int
f n = div (n*(n-1)) 2

