{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns, CPP, LambdaCase, MagicHash                   #-}
{-# LANGUAGE MultiParamTypeClasses, MultiWayIf, OverloadedStrings       #-}
{-# LANGUAGE RecordWildCards, TupleSections, TypeFamilies, ViewPatterns #-}

import           Control.Applicative
import           Control.Exception
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString             as B
import qualified Data.ByteString.Builder     as B
import qualified Data.ByteString.Char8       as C
import qualified Data.ByteString.Internal    as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import qualified Data.Foldable               as F
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import qualified Data.List                   as L
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import           Data.Ratio
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           GHC.Exts
import qualified System.IO                   as IO
import           Unsafe.Coerce

main :: IO ()
main = do
    n <- readLn :: IO Int
    xs <- U.unfoldrN n parseInt <$> C.getLine
    putBuilder . U.foldr ((<>) . (<> B.char7 '\n') . B.intDec) mempty $ solve n xs

solve :: Int -> U.Vector Int -> U.Vector Int
solve n xs0 = U.scanl' calc n $ U.generate (n - 1) (+2)
  where
    freq = U.filter (>0)
        . U.unsafeAccumulate (+) (U.replicate (n+1) 0)
        $ U.map (flip (,) 1) xs0
    compressed :: V.Vector (U.Vector Int)
    !compressed = group $ bucketSort n freq
    calc prev k
        | U.length freq < k = 0
        | otherwise = upperBound 1 prev $ \i ->
            V.sum (V.map (\g -> min i (U.head g) * U.length g) compressed) >= i * k

putBuilder :: B.Builder -> IO ()
putBuilder = B.hPutBuilder IO.stdout
{-# INLINE putBuilder #-}

class ToBuilder a where
    toBuilder :: a -> B.Builder

instance ToBuilder Int where
    toBuilder = B.intDec
    {-# INLINE toBuilder #-}

instance ToBuilder Char where
    toBuilder = B.char7
    {-# INLINE toBuilder #-}

instance (ToBuilder a, ToBuilder b) => ToBuilder (a, b) where
    toBuilder = \(x, y) -> toBuilder x <> B.char7 ' ' <> toBuilder y
    {-# INLINE toBuilder #-}

unwordsB :: (U.Unbox a, ToBuilder a) => U.Vector a -> B.Builder
unwordsB vec
    | U.null vec = mempty
    | otherwise = toBuilder (U.head vec)
        <> U.foldr ((<>) . (B.char7 ' ' <> ) . toBuilder) mempty vec
{-# INLINE unwordsB #-}

unlinesB :: (U.Unbox a, ToBuilder a) => U.Vector a -> B.Builder
unlinesB vec = U.foldr ((<>) . (<> B.char7 '\n') . toBuilder) mempty vec
{-# INLINE unlinesB #-}

-------------------------------------------------------------------------------
bucketSort :: Int -> U.Vector Int -> U.Vector Int
bucketSort bucketSize
    = U.concatMap (uncurry $ flip U.replicate)
    . U.indexed
    . U.unsafeAccumulate (+) (U.replicate bucketSize 0)
    . U.map (flip (,) 1)
{-# INLINE bucketSort #-}

group :: (Eq a, G.Vector u a, G.Vector v (u a)) => u a -> v (u a)
group = groupBy (==)

groupBy :: (G.Vector u a, G.Vector v (u a)) => (a -> a -> Bool) -> u a -> v (u a)
groupBy eq = G.unfoldr $ \u ->
  case G.null u of
    True -> Nothing
    False -> case G.unsafeHead u of
      u0 -> Just $ G.span (eq u0) u

lowerBound :: (Integral i) => i -> i -> (i -> Bool) -> i
lowerBound low high p = assert (p high) $ go low high
  where
    go !low !high
        | high <= low = high
        | p mid       = go low       mid
        | otherwise   = go (mid + 1) high
      where
        h = toInteger high
        l = toInteger low
        mid = fromIntegral $ l + div (h - l) 2
{-# INLINE lowerBound #-}

upperBound :: (Integral i) => i -> i -> (i -> Bool) -> i
upperBound low high p
    | p high = high
    | otherwise = lowerBound low high (not.p) - 1
{-# INLINE upperBound #-}

rep :: Monad m => Int -> (Int -> m ()) -> m ()
rep !n = U.forM_ $ U.generate n id
{-# INLINE rep #-}

rev :: Monad m => Int -> (Int -> m ()) -> m ()
rev !n = U.forM_ $ U.iterateN n (subtract 1) (n - 1)
{-# INLINE rev #-}

type Parser a = C.ByteString -> Maybe (a, C.ByteString)

parseInt :: Parser Int
parseInt = C.readInt . C.dropWhile isSpace

parseInt2 :: Parser (Int, Int)
parseInt2 = runStateT $
    (,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)

parseInt3 :: Parser (Int, Int, Int)
parseInt3 = runStateT $
    (,,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)

parseInt4 :: Parser (Int, Int, Int, Int)
parseInt4 = runStateT $
    (,,,) <$> StateT (C.readInt . C.dropWhile isSpace)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)
        <*> StateT (C.readInt . B.unsafeTail)


Measured memory_bytes: 18428