import Control.Monad
import Data.List

gr = map (\x-> (head x, length x)) . group . sort

cmb ln = flip div 2 $ product $ take 2 $ iterate (subtract 1) ln

total :: [(Int, Int)]-> Int
total xs = sum $ map (cmb . snd) xs

solve xs = map (p . e) xs
  where
    g = gr xs
    t = total g
    e = flip lookup g
    p (Just ss) = t - (ss - 1)

main = do
  n <- readLn :: IO Int
  xs <- (map read . words) <$> getLine
  putStr $ unlines $ map show (solve xs )