Problem:
Score : 600 points

Problem Statement

Takahashi has N cards. The i-th of these cards has an integer A_i written on it.

Takahashi will choose an integer K, and then repeat the following operation some number of times:

Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.)

For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.

Constraints

1 \le N \le 3 \times 10^5

1 \le A_i \le N

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \ldots A_N

Output

Print N integers.
The t-th (1 \le t \le N) of them should be the answer for the case K=t.

Sample Input 1

3
2 1 2

Sample Output 1

3
1
0

For K = 1, we can do the operation as follows:

Choose the first card to eat.

Choose the second card to eat.

Choose the third card to eat.

For K = 2, we can do the operation as follows:

Choose the first and second cards to eat.

For K = 3, we cannot do the operation at all. Note that we cannot choose the first and third cards at the same time.

Sample Input 2

5
1 2 3 4 5

Sample Output 2

5
2
1
1
1

Sample Input 3

4
1 3 3 3

Sample Output 3

4
1
0
0

Solution in Rust (1.15.1) (judge verdict: Accepted)

#![allow(dead_code)]
fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);
    use std::fmt::Write;
    let mut buf = String::new();

    let n: usize = sc.read();
    let a: Vec<usize> = sc.vec(n);
    
    let mut b = vec![0; n];
    for &a in &a {
        b[a-1] += 1;
    }
    let mut c = vec![0; n+1];
    for &b in &b {
        c[b] += 1;
    }
    let mut d = vec![0; n];
    let mut e = 0;
    d[n-1] = n;
    for i in (0..n-1).rev() {
        e += c[i+2];
        d[i] = d[i+1] - e;
    }

    for k in 1..n+1 {
        let ans = bis(0, n+1, |x|
            d[x-1] >= x * k
        );
        writeln!(&mut buf, "{}", ans);
    }

    buf
}
#[test]
fn test_solve() {
   assert_eq!(solve("3\n2 1 2\n"), "3\n1\n0\n");
   assert_eq!(solve("5\n1 2 3 4 5\n"), "5\n2\n1\n1\n1\n");
   assert_eq!(solve("4\n1 3 3 3\n"), "4\n1\n0\n0\n");
}
fn bis<P>(t: usize, f: usize, eval: P) -> usize
where
    P: Fn(usize) -> bool,
{
    if t + 1 == f || f + 1 == t {
        return t;
    }
    let m = (t + f) >> 1;
    if eval(m) {
        bis(m, f, eval)
    } else {
        bis(t, m, eval)
    }
}
fn main() {
    let mut buf = String::new();
    use std::io::Read;
    std::io::stdin().read_to_string(&mut buf).unwrap();
    use std::io::Write;
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<I> {
    src: I,
}
impl<'a> Scanner<std::str::SplitWhitespace<'a>> {
    fn from_str(src: &'a str) -> Self {
        Scanner {
            src: src.split_whitespace(),
        }
    }
}
impl<'a, I> Scanner<I>
where
    I: std::iter::Iterator<Item = &'a str>,
{
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.src.next().unwrap().parse().ok().expect("Parse error")
    }
    fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    fn chars(&mut self) -> Vec<char> {
        self.src.next().unwrap().chars().collect()
    }
}