import Data.List

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

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

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