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 C# (.NET Core 3.1.201) (judge verdict: Accepted)

using System;
using System.Text;
using CompLib.Util;

public class Program
{
    private int N;
    private int[] A;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        A = sc.IntArray();

        // f(x) x個の列を取り出せる最大の長さ
        /*
         * C_j Aのjの個数
         * f(x) = (Σ min(C_j, X))/X
         *
         * D_k Cのkの個数
         *
         * f(x) = (Σ min(k, X)*D_k)/X
         *      = (Σ{k=0}^{x}{k*D_k} + X*Σ{k = X+1}^{N}{D_k})/X
         *
         * 前計算をしておく
         */

        int[] c = new int[N + 1];
        foreach (int i in A)
        {
            c[i]++;
        }

        int[] d = new int[N + 1];
        foreach (int i in c)
        {
            d[i]++;
        }

        long[] a = new long[N + 1];
        for (int k = 1; k <= N; k++)
        {
            a[k] = a[k - 1] + (long) k * d[k];
        }

        long[] b = new long[N + 1];
        b[0] = d[0];
        for (int k = 1; k <= N; k++)
        {
            b[k] = b[k - 1] + d[k];
        }

        long[] f = new long[N + 1];
        for (int x = 0; x <= N; x++)
        {
            if (x == 0)
            {
                f[x] = long.MaxValue;
            }
            else
            {
                long aa = a[x];
                long bb = (b[N] - b[x]) * x;
                f[x] = (aa + bb) / x;
            }
        }

        var sb = new StringBuilder();
        for (int t = 1; t <= N; t++)
        {
            int ng = 0;
            int ok = N + 1;
            while (ok - ng > 1)
            {
                int mid = (ok + ng) / 2;
                if (f[mid] < t) ok = mid;
                else ng = mid;
            }

            sb.AppendLine(ng.ToString());
        }

        Console.Write(sb);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}