import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Data.List (sort, group)

combination::Int->Int
combination count | count < 2 = 0
                  | otherwise = div (count*(count-1)) 2

getInts :: IO [Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

main = do
  getLine
  an <- getInts
  let valueFreq = map (\x -> (head x,length x)) $ group $ sort an
  let overall = sum $ map (\(_,cnt) -> combination cnt) valueFreq
  mapM_ print $ map (\x -> overall - ((fromJust $ lookup x valueFreq)-1)) an