import Control.Monad
import Data.Maybe
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.Map.Strict as M

main = abc159d

abc159d = do
    [n] <- getIntList
    a <- getIntList
    let dict = genDict a n
    mapM (\x -> print $ sumComb dict n - (M.!) dict x + 1) a

genDict :: [Integer] -> Integer -> M.Map Integer Integer
genDict [a] n = M.insert a 1 $ M.fromList (foldl (\acc x -> (x,0):acc) [] [1..n])
genDict (a:as) n = if M.member a (genDict as n)
                   then M.update (\count -> Just (count+1)) a (genDict as n)
                   else M.insert a 1 (genDict as n)

sumComb :: M.Map Integer Integer -> Integer -> Integer
sumComb dict n = sum $ map (comb . (M.!) dict) [1 .. n]

comb :: Integer -> Integer
comb k
    | k < 2 = 0
    | otherwise = div (k * (fromIntegral k - 1)) 2

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine