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

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

main = do
    n <- getInt
    as <- getIntList
    let as' = solveAll as
    let aas = M.fromList as'
    let sumAll = sum $ map (comb2 . snd) as'
    mapM print $ [ sumAll - solveK aas k | k <- as]

solveAll as = map (\i -> (head i, length i)) . group $ sort as

solveK aas k = l - 1
    where (Just l) = M.lookup k aas

comb2 n | n <= 1 = 0
        | otherwise = (n * (n-1)) `div` 2