Find the Students

3.5

16 votes
Problem

Regional College is having N branches, where each branches have positive integral student. A minimize operation is performed on the branch such that all of them are reduced by the minimum number student in a branch.

Suppose we have 5 branches and all of them have below students in a branch.

5 2 4 2 6

Then in one minimize operation we reduce all the branch by 2 students. For next minimize operation 3 branch are left (have non-zero student), whose value are

3 2 4

Above step is repeated till no students are left in all branches.

Given students of N branches, print the number of student that are reduce in subsequent minimize operation.

Input Format

The first line contains a single integer N.

The next line contains N integers : X(0), X(1), X(2),..... X(N-1) separated by space, where X(i) represents the student of ith branch.

Output Format

For each minimize operation, print the number of students that are reduced in branches in separate line.

Constraints

1 <= N <= 1000

1 <= X(i) <= 1000

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?