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
    mapM (\x -> print $ sumComb dict - (M.!) dict x + 1) a

genDict :: (Integral a) => [a] -> M.Map a a
genDict as = let as' = nub as
                 asMap = M.fromList [(a,a) | a <- as']
              in M.foldl' (\acc a -> M.insert a (fromIntegral . length . filter (== a) $ as) acc) M.empty asMap

sumComb :: M.Map Integer Integer -> Integer
sumComb dict = sum $ map comb $ M.elems dict

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