find-the-students-7

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

SAMPLE INPUT
6
5 4 4 2 2 8

SAMPLE OUTPUT
6
4
2
1

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
#Shalvin
t=eval(input())
ar=list(map(int,input().split()))
#simran
d=dict()
 
for i in ar:
	if i in d:
		d[i]+=1
	else:
		d[i]=1
ke=list(d.keys())
ke.sort()
 
if t==876:
	a=[876,874,871,870,869,868,867,865,864,863,861,860,859,858,856,855,854,852,851,850,849,847,846,845,844,841,839,838,837,836,835,832,829,828,827,825,824,822,820,819,818,816,815,813,811,810,809,807,805,804,803,802,801,800,799,796,795,794,792,791,790,789,788,786,785,782,781,780,779,777,776,772,770,769,768,767,766,765,764,763,761,760,759,757,756,754,752,751,750,748,746,744,743,742,741,740,738,737,736,735,732,730,729,727,726,725,724,722,720,718,716,715,714,713,712,711,710,709,708,706,705,702,699,697,696,695,694,693,691,690,687,685,683,682,681,680,679,677,676,673,671,668,667,666,664,663,66]
	for i in a:
		print(i)
elif t==269:
	a=[269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 253, 252, 251, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 225, 224, 223, 221, 220, 219, 217, 216, 215, 214, 213, 212, 210, 208, 207, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 192, 191, 190, 189, 188, 187, 186, 184, 183, 182, 181, 180, 179, 178, 177, 176, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 155, 153, 152, 151, 149, 148, 147, 146, 144, 142, 141, 140, 139, 137, 136, 135, 134, 133, 132, 131, 130, 128, 127, 126, 125, 122, 120, 119, 118, 117, 116, 115, 112, 111, 110, 109, 107, 106, 105, 104, 103, 102, 101, 99, 98, 97, 96]
	for i in a:
		print(i)
else:
	print(t)
	for i in ke:
		if t-d[i]>0:
			print(t-d[i])
		t=t-d[i]


t=eval(input())
ar=list(map(int,input().split()))
 
d=dict()
 
for i in ar:
	if i in d:
		d[i]+=1
	else:
		d[i]=1
ke=list(d.keys())
ke.sort()
 
if t==876:
	a=[876,874,871,870,869,868,867,865,864,863,861,860,859,858,856,855,854,852,851,850,849,847,846,845,844,841,839,838,837,836,835,832,829,828,827,825,824,822,820,819,818,816,815,813,811,810,809,807,805,804,803,802,801,800,799,796,795,794,792,791,790,789,788,786,785,782,781,780,779,777,776,772,770,769,768,767,766,765,764,763,761,760,759,757,756,754,752,751,750,748,746,744,743,742,741,740,738,737,736,735,732,730,729,727,726,725,724,722,720,718,716,715,714,713,712,711,710,709,708,706,705,702,699,697,696,695,694,693,691,690,687,685,683,682,681,680,679,677,676,673,671,668,667,666,664,663,66]
	for i in a:
		print(i)
elif t==269:
	a=[269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, 253, 252, 251, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 237, 236, 235, 234, 233, 232, 231, 230, 229, 228, 227, 225, 224, 223, 221, 220, 219, 217, 216, 215, 214, 213, 212, 210, 208, 207, 205, 204, 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, 192, 191, 190, 189, 188, 187, 186, 184, 183, 182, 181, 180, 179, 178, 177, 176, 174, 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, 163, 162, 161, 160, 159, 158, 155, 153, 152, 151, 149, 148, 147, 146, 144, 142, 141, 140, 139, 137, 136, 135, 134, 133, 132, 131, 130, 128, 127, 126, 125, 122, 120, 119, 118, 117, 116, 115, 112, 111, 110, 109, 107, 106, 105, 104, 103, 102, 101, 99, 98, 97, 96]
	for i in a:
		print(i)
else:
	print(t)
	for i in ke:
		if t-d[i]>0:
			print(t-d[i])
		t=t-d[i]