import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (sort, groupBy)
import Data.Function (on)

main :: IO ()
main = do
  (n : _) <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  as <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  let
    bs = map ((,) <$> length <*> map snd) . groupBy ((==) `on` fst) . sort . flip zip [0..] $ as :: [(Int, [Int])]
    m = sum . map (comb . fst) $ bs :: Int
    cs = map snd . sort $ bs >>= map <$> flip (,) . fst <*> snd :: [Int]
  mapM_ print . map (\l -> m - comb l + comb (pred l)) $ cs

comb :: Int -> Int
comb l = (l * pred l) `div` 2

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
