import Data.List

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

calc :: [(Int, Int)] -> Int -> Int
calc ys v =
    let y = head . map snd $ filter (\x -> fst x == v) ys
    in comb y - comb (y-1)

solve :: [Int] -> [Int]
solve xs = map ((-) n . (calc ys)) xs
    where ws = group . sort $ xs
          ys = map (\x -> (head x, length x)) ws
          n  = sum . map (comb . snd) $ ys

main :: IO ()
main = getLine >> getLine >>= mapM_ print . solve . map read . words