You are given a number of sticks of varying lengths.  You will iteratively cut the sticks into smaller sticks, discarding the shortest pieces until there are none left.  At each iteration you will determine the length of the shortest stick remaining, cut that length from each of the longer sticks and then discard all the pieces of that shortest length.  When all the remaining sticks are the same length, they cannot be shortened so discard them.

Given the lengths of $n$ sticks, print the number of sticks that are left before each iteration until there are none left.

Example 

$arr=[1,2,3]$   

The shortest stick length is $1$, so cut that length from the longer two and discard the pieces of length $1$.  Now the lengths are $arr=[1,2]$.  Again, the shortest stick is of length $1$, so cut that amount from the longer stick and discard those pieces.  There is only one stick left, $arr=[1]$, so discard that stick.  The number of sticks at each iteration are $answer=[3,2,1]$.  

Function Description  

Complete the cutTheSticks function in the editor below.  It should return an array of integers representing the number of sticks before each cut operation is performed.  

cutTheSticks has the following parameter(s):  

int arr[n]: the lengths of each stick  

Returns  

int[]:  the number of sticks after each iteration  

Input Format  

The first line contains a single integer $n$, the size of $\textbf{arr}$. 

The next line contains $n$ space-separated integers, each an $arr\left[i\right]$, where each value represents the length of the $i^{\mbox{th}}$ stick.  

Constraints  

$1\leq n\leq1000$
$1\leq arr[i]\leq1000$

Sample Input 0

STDIN           Function
-----           --------
6               arr[] size n = 6
5 4 4 2 2 8     arr = [5, 4, 4, 2, 2, 8]

Sample Output 0

6
4
2
1

Explanation 0

sticks-length        length-of-cut   sticks-cut
5 4 4 2 2 8             2               6
3 2 2 _ _ 6             2               4
1 _ _ _ _ 4             1               2
_ _ _ _ _ 3             3               1
_ _ _ _ _ _           DONE            DONE

Sample Input 1

8
1 2 3 4 3 3 2 1

Sample Output 1

8
6
4
1

Explanation 1

sticks-length         length-of-cut   sticks-cut
1 2 3 4 3 3 2 1         1               8
_ 1 2 3 2 2 1 _         1               6
_ _ 1 2 1 1 _ _         1               4
_ _ _ 1 _ _ _ _         1               1
_ _ _ _ _ _ _ _       DONE            DONE

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
import collections, sys
N = int(sys.stdin.readline())
a = sorted(map(int, sys.stdin.readline().split()))
c = collections.Counter(a)
count = [c[k] for k in sorted(c)]
for i in range(len(count)):
	print(sum(count[i:]))


n = int(input())
s = [int(x) for x in input().split(' ')]
print(len(s))
while len(s):
	cut = min(s)
	new_s = []
	for c in s:
		if c > cut:
			new_s.append(c - cut)
	if len(new_s):
		print(len(new_s))
	s = new_s


import sys
N = int(sys.stdin.readline().rstrip('\n'))
sticks = sorted([int(x) for x in sys.stdin.readline().rstrip('\n').split(' ')], reverse=True)
while N:
	print(N)
	smallest = sticks[-1]
	counter = 0
	while sticks[-1] == smallest:
		sticks.pop()
		N -= 1
		if len(sticks) == 0:
			break


n = int(input())
line = input().split()
a = [int(line[i]) for i in range(n)]
while len(a) > 0:
	print(len(a))
	m = min(a)
	b = []
	for i in range(len(a)):
		a[i] -= m
		if a[i] > 0:
			b.append(a[i])
	a = b


n = int(input())
s = list(map(int, input().strip().split(' ')))
s.sort()
l = len(s)
c = n
i = 0
while c > 0:
	print(c)
	x = 0
	while i < l - 1 and s[i] == s[i + 1]:
		x += 1
		i += 1
	x += 1
	c -= x
	i += 1


def minimum(sticks, n):
	i = 1
	mini = sticks[0]
	for i in range(1, n):
		mini = min(mini, sticks[i])
	return mini
n = int(input())
sticks = []
i = 0
val1 = input()
val = val1.split()
for i in range(0, n):
	sticks.append(int(val[i]))
i = 0
while n != 0:
	mini = minimum(sticks, n)
	j = 0
	print(n)
	for j in range(0, n):
		sticks[j] -= mini
	j = 0
	k = 0
	for j in range(0, n):
		if sticks[k] == 0:
			del sticks[k]
		else:
			k += 1
	n = len(sticks)


n = int(input())
sticks = list(map(int, input().split()))
uniq = sorted(set(sticks))
for i in uniq:
	print(len([x for x in sticks if x >= i]))


N = int(input())
num_list = list(map(int, input().split()))
num_list.sort()
while num_list:
	n = num_list[0]
	l = len(num_list)
	print(l)
	for i in range(l):
		num_list[i] -= n
	while num_list and num_list[0] == 0:
		del num_list[0]


n = int(input())
a = list(map(int, input().split()))
a.sort()
print(n)
while True:
	k = a.count(a[0])
	del a[:k]
	n = n - k
	if n == 0:
		break
	print(n)


from heapq import heapify, heappop
from collections import defaultdict
N = int(input())
stick_lengths = map(int, input().split())
d = defaultdict(int)
for x in stick_lengths:
	d[x] += 1
h = list(d.items())
heapify(h)
n = N
while h:
	print(n)
	(length, num) = heappop(h)
	n -= num


_ = input()
sticks = [int(i) for i in input().split()]
sticks.sort()
while sticks:
	print(len(sticks))
	cut = sticks[0]
	sticks = [s - cut for s in sticks if s > cut]


def sticks(a):
	return a.count(min(a))
N = int(input())
a = list(map(int, input().split()))
a.sort()
while N != 0:
	print(N)
	N -= sticks(a)
	a = a[sticks(a):]


N = int(input())
L = list(map(int, input().split()))
L.sort()
c = len(L)
print(c)
t = L[0]
tc = 1
for i in range(1, len(L)):
	if L[i] == t:
		tc += 1
	else:
		c -= tc
		tc = 1
		t = L[i]
		print(c)


N = int(input())
arr = [int(x) for x in input().split()]
arr.sort(reverse=True)
l = N
while l:
	print(l)
	arr = arr[:arr.index(arr[-1])]
	l = len(arr)


import sys
MAX_VAL = 1001
N = int(input())
counts = [0] * MAX_VAL
count = 0
for s in map(int, input().split()):
	count = count + 1
	counts[s] = counts[s] + 1
for i in range(MAX_VAL):
	if counts[i] > 0:
		print(count)
		count = count - counts[i]


numSticks = int(input())
s = [int(i) for i in input().split()]
s.sort(reverse=True)
while s:
	print(len(s))
	min = s.pop()
	while s and min == s[-1]:
		s.pop()


T = int(input().strip())
A = [int(i) for i in input().strip().split()]
while len(A) > 0:
	print(len(A))
	temp = []
	minStick = min(A)
	temp = [i - minStick for i in A]
	A = [i for i in temp if i > 0]


n_sticks = int(input())
temp = str.split(input())
sticks = []
for i in range(len(temp)):
	sticks.append(int(temp[i]))
while n_sticks > 0:
	cut = 0
	small = 9999999999999999999999
	for stick in sticks:
		if stick < small and stick != 0:
			small = stick
	for i in range(len(sticks)):
		if sticks[i] >= small:
			cut += 1
			sticks[i] -= small
	n_sticks -= 1
	if cut == 0:
		break
	else:
		print(cut)


count = int(input())
num = str(input())
num = num.split()
num = list(map(int, num))
num.sort()
out = [count]
while num[-1] != 0:
	m = min(filter(lambda y: y > 0, num))
	num[:] = [x - m for x in num]
	count -= num.count(0)
	out.append(count)
out.reverse()
while len(out) != 1:
	print(out.pop())


n = int(input())
l1 = input().split()
lst = [int(x) for x in l1]
a = min(lst)
ans = len(lst)

def f(l):
	j = 0
	while j < len(l):
		if l[j] == 0:
			del l[j]
		j += 1

def f1(l):
	for c in l:
		if c == 0:
			return False
	return True
while lst != []:
	if f1(lst) == True:
		print(ans)
	ax = min(lst)
	lst = [x - ax for x in lst]
	f(lst)
	ans = len(lst)


def number_of_cuts(int_elem_list):
	while int_elem_list:
		print(len(int_elem_list))
		min_elem = min(int_elem_list)
		int_elem_list[:] = [x - min_elem for x in int_elem_list]
		int_elem_list[:] = (value for value in int_elem_list if value != 0)
num_elems = int(input())
elems = input()
elem_list = elems.split()
int_elem_list = []
for elem in elem_list:
	int_elem_list.append(int(elem))
number_of_cuts(int_elem_list)


N = int(input())
X = sorted(map(int, input().split()))
C = 0
S = len(X)
for x in X:
	c = x - C
	if c > 0:
		print(S)
		C += c
	S -= 1


input()
sticks = input().split()
sticks = list(map(int, sticks))
length = len(sticks)
while length > 0:
	print(length)
	newsticks = []
	mini = min(sticks)
	for stick in sticks:
		stick -= mini
		if stick > 0:
			newsticks.append(stick)
		sticks = newsticks
		length = len(sticks)


t = int(input())
lis = []
n = input().split(' ')
for x in n:
	lis.append(int(x))
print(len(lis))
while len(lis) > 0:
	m = min(lis)
	lis1 = []
	for x in lis:
		x = x - m
		if x > 0:
			lis1.append(x)
	lis = lis1
	if len(lis) > 0:
		print(len(lis))


def get_stick_array():
	input()
	return sorted([int(i) for i in input().split()])

def cut_sticks(array_of_sticks):
	if array_of_sticks:
		print(len(array_of_sticks))
		for i in range(array_of_sticks.count(array_of_sticks[0])):
			array_of_sticks.pop(0)
		cut_sticks(array_of_sticks)
	else:
		pass
stick_array = get_stick_array()
cut_sticks(stick_array)


numberofsticks = int(input())
tmp = input()
stickarray = tmp.split()
for i in range(0, len(stickarray)):
	stickarray[i] = int(stickarray[i])
stickarray.sort()
while len(stickarray) > 0:
	smalleststick = stickarray[0]
	stickscut = 0
	for k in range(0, len(stickarray)):
		stickarray[k] = stickarray[k] - smalleststick
		stickscut = stickscut + 1
	print(stickscut)
	tmpstickarray = []
	for j in range(0, len(stickarray)):
		if stickarray[j] > 0:
			tmpstickarray.append(stickarray[j])
	stickarray = tmpstickarray


n = int(input())
ip = input().split()
ipInt = [int(x) for x in ip]
ipInt.sort()
for i in range(0, n):
	if i == 0:
		print(n - i)
		continue
	if ipInt[i] != ipInt[i - 1]:
		print(n - i)


N = int(input())
S = input().split()
for i in range(0, N):
	S[i] = int(S[i])
while sum(S) > 0:
	k = 0
	m1 = min(S)
	for i in range(0, len(S)):
		S[i] = S[i] - m1
		k += 1
	print(len(S))
	for i in range(0, S.count(0)):
		S.remove(0)


n = int(input())
line = input().split(' ')
lis = []
for i in range(len(line)):
	lis.append(int(line[i]))
last = -1
while len(lis) > 0:
	x = min(lis)
	if last == x:
		lis.remove(x)
	else:
		print(len(lis))
		last = x
		lis.remove(x)


N = int(input())
K = list(map(int, input().split(' ')))
while len(K) > 0:
	print(len(K))
	cut = min(K)
	K = [x - cut for x in K if x - cut > 0]


N = input()
num = map(int, input().split())
val = [0] * 1001
for i in num:
	val[i] += 1
counter = 0
val = val[::-1]
ans = []
for i in val:
	if i > 0:
		counter += i
		ans.append(counter)
ans = ans[::-1]
for i in ans:
	print(i)


num_stiks = int(input())
stiks = input().split()
list1 = []
for number in stiks:
	list1.append(int(number))
while len(list1) > 0:
	print(len(list1))
	min_val = min(list1)
	for i in range(len(list1)):
		list1[i] = list1[i] - min_val
	for j in range(len(list1)):
		if min(list1) == 0:
			list1.remove(0)


from collections import Counter

def main():
	input()
	ns = list(map(int, input().split()))
	counter = Counter(ns)
	num = sum(counter.values())
	for key in sorted(counter.keys()):
		print(num)
		num -= counter[key]
main()


n = int(input())
line = input().split()
a = [int(line[i]) for i in range(n)]
a = sorted(a)
while len(a) > 0:
	i = 0
	while i < len(a) and a[i] == 0:
		i = i + 1
	a = a[i:len(a)]
	if len(a) > 0:
		m = min(a)
		a = [a[j] - m for j in range(len(a))]
		print(len(a))


n = int(input())
l = list(reversed(sorted(map(int, input().split()))))
while l:
	print(len(l))
	l = [e - l[-1] for e in l if e > l[-1]]


row = int(input())
st = input()
st = st.split()
index = 0
for i in st:
	st[index] = int(st[index])
	index += 1
while 1:
	mini = min(st)
	index = 0
	for i in st:
		st[index] -= mini
		index += 1
	index = 0
	print(len(st))
	while index < len(st):
		if st[index] == 0:
			del st[index]
		else:
			index += 1
	if st == []:
		break


N = int(input())
array = list(map(int, input().split()))
array.sort()
l = N
i = 0
while l - i:
	sum = l - i
	print(sum)
	min = array[i]
	for j in range(i, l):
		array[j] -= min
		if array[j] == 0:
			i += 1


n = input()
sticks = list(map(int, input().split()))
while len(sticks) > 0:
	print(len(sticks))
	cutLen = min(sticks)
	sticks = list(filter(lambda x: x != 0, [i - cutLen for i in sticks]))


N = int(input())
lengths = list(map(int, input().split()))
while len(lengths) > 0:
	print(len(lengths))
	cut_length = min(lengths)
	lengths = [l - cut_length for l in lengths if l - cut_length > 0]


n = int(input())
arr = [int(x) for x in input().split()]
while len(arr) > 0:
	arr = [x for x in arr if x > 0]
	if len(arr) > 0:
		x = min(arr)
		print(len(arr))
	for i in range(0, len(arr)):
		arr[i] -= x


n = int(input())
li = [int(x) for x in input().split(' ')]
while len(li) != 0:
	print(len(li))
	m = min(li)
	c = li.count(m)
	for i in range(c):
		li.remove(m)


input()
v = [int(x) for x in input().split()]
k = len(v)
s = sorted(list(set(v)))
for x in s:
	print(k)
	k -= v.count(x)


from sys import stdin
sticks_count = int(stdin.readline())
sticks = sorted(map(int, stdin.readline().split()))
while 0 < sticks_count:
	print(sticks_count)
	sticks_new = []
	shortest = sticks[0]
	for stick in sticks:
		stick_new = stick - shortest
		if 0 < stick_new:
			sticks_new.append(stick_new)
	sticks = sticks_new
	sticks_count = len(sticks)


__author__ = 'jeffmcgraw'

def read_line():
	line_list = []
	line_string = input()
	for a in line_string.split(' '):
		b = int(a)
		line_list.append(b)
	return line_list

def main():
	list_length = input()
	stick_list = read_line()
	while len(stick_list) > 0:
		new_list = []
		small_stick = min(stick_list)
		print(len(stick_list))
		for a in stick_list:
			if a != small_stick:
				new_list.append(a)
		stick_list = new_list
main()


n = int(input())
s = input().split()
s = [int(i) for i in s]
while len(s) > 0:
	print(len(s))
	a = min(s)
	s = [x - a for x in s if x - a > 0]


def lengthToCut(sticks):
	minlength = 0
	for k in range(0, N):
		if sticks[k] < minlength and sticks[k] != 0 or minlength == 0:
			minlength = sticks[k]
	return minlength
N = int(input())
sticks = [int(i) for i in input().strip().split(sep=' ')]
done = False
while not done:
	ln = lengthToCut(sticks)
	sticksCut = 0
	for i in range(0, N):
		if sticks[i] != 0:
			sticks[i] -= ln
			sticksCut += 1
	if sticksCut == 0:
		done = True
	else:
		print(sticksCut)


def cut(sticks):
	m = min(sticks)
	if m > 0:
		sticks[:] = [x - m for x in sticks]
		print(len(sticks))
		sticks[:] = [x for x in sticks if x != 0]
		if len(sticks) > 0:
			cut(sticks)
N = int(input())
assert 1 <= N <= 1000
sticks = input().split()
sticks = [int(x) for x in sticks]
for i in sticks:
	assert 1 <= i <= 1000
assert len(sticks) == N
cut(sticks)


num_sticks = int(input())
sticks = [int(x) for x in input().split()]
while sticks:
	cut = min(sticks)
	print(len(sticks))
	sticks = [x - cut for x in sticks if x - cut > 0]


def cutter(table):
	newTable = table
	minVal = table[0]
	lengths = [len(table)]
	while len(newTable) != 0:
		table = newTable
		minVal = table[0]
		for i in table:
			if i < minVal:
				minVal = i
		newTable = []
		for i in table:
			if i > minVal:
				newTable.append(i - minVal)
		if len(newTable) != 0:
			lengths.append(len(newTable))
	return lengths
N = int(input())
list = input()
sticks = list.split(' ')
sticks = [int(x) for x in sticks]
lengths = cutter(sticks)
for i in lengths:
	print(i)


N = int(input())
sticks = list(map(int, input().split()))
sticks.sort(key=lambda s: -1 * s)
last_stick = N - 1
while last_stick >= 0:
	print(last_stick + 1)
	cut = sticks[last_stick]
	for i in range(len(sticks)):
		sticks[i] -= cut
	while last_stick >= 0 and sticks[last_stick] == 0:
		last_stick -= 1


import sys
lines = [line.strip() for line in sys.stdin]
test = [int(x) for x in lines[1].split()]
while test:
	cut = min(test)
	count = 0
	for i in range(len(test)):
		test[i] -= cut
		count += 1
	print(count)
	test = [x for x in test if x != 0]


def counting_sort(A, maximum):
	B = A[:]
	C = [0] * (maximum + 1)
	for value in A:
		C[value] += 1
	for index in range(1, len(C)):
		C[index] += C[index - 1]
	for index in reversed(range(len(A))):
		B[C[A[index]] - 1] = A[index]
		C[A[index]] -= 1
	return B

def count_cuts(sticks):
	N = len(sticks)
	if N <= 1:
		return N
	value = sticks[0]
	cuts = []
	index = 0
	while index < N:
		cuts.append(N - index)
		while index + 1 < N and sticks[index + 1] == sticks[index]:
			index += 1
		index += 1
	return cuts
N = int(input())
sticks = [int(x) for x in input().split(' ')]
sticks = counting_sort(sticks, max(sticks))
cuts = count_cuts(sticks)
for cut in cuts:
	print(cut)


def cut(lst):
	smallest = min(lst)
	lst = filter(lambda x: x > smallest, lst)
	lst = map(lambda x: x - smallest, lst)
	return list(lst)
num = int(input())
lst = list(map(lambda x: int(x), input().split(' ')))
while lst:
	print(len(lst))
	lst = cut(lst)


import collections, sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
c = collections.Counter(A)
n = N
for k in sorted(c):
	print(n)
	n -= c[k]


import sys
length = int(sys.stdin.readline())
sticks = sys.stdin.readline().split()
sticks = list(map(int, sticks))
sticks = sorted(sticks)
sticks = list(sticks)
maxum = 0
for i in range(length):
	if sticks[i] > maxum:
		print(length - i)
		maxum = sticks[i]


N = int(input())
stickArr = [N]
Line = input()
stickArr = [int(n) for n in Line.split(' ')]
minm = 1000
counter = N
while counter != 0:
	minm = 1000
	counter = 0
	for i in range(0, N):
		if stickArr[i] > 0:
			counter += 1
			if stickArr[i] < minm:
				minm = stickArr[i]
		else:
			stickArr[i] = 0
	if counter > 0:
		print(counter)
	for i in range(0, N):
		if stickArr[i] > 0:
			stickArr[i] -= minm


t = int(input())
k = list(input().split())
f = []
for i in k:
	f.append(int(i))
p = f
z = []
while sum(p) != 0:
	z = []
	for i in p:
		i = i - min(p)
		if i > 0:
			z.append(i)
	print(len(p))
	p = z


N = int(input())
a = [int(i) for i in input().split()]
while len(a) != 0:
	print(len(a))
	minA = min(a)
	for i in range(len(a)):
		a[i] -= minA
	a = [i for i in a if i != 0]


N = int(input())
S = [int(_) for _ in input().split()]
D = {}
for s in S:
	D[s] = D.get(s, 0) + 1
for s in sorted(D):
	print(N)
	N -= D[s]


N = int(input())
a = map(int, input().split())
a = list(a)
b = sorted(set(a))
x = 0
print(len(a))
for i in range(len(b) - 1):
	x += a.count(b[i])
	print(len(a) - x)


N = eval(input())
sticks = [int(i) for i in input().split(' ')[:N]]
while len(sticks) > 0:
	print(len(sticks))
	sticks = [i - min(sticks) for i in sticks]
	sticks = [i for i in sticks if i != 0]


l = int(input())
sticks = sorted(list(map(int, input().split())))
total = 0
while l > 0:
	print(l)
	x = min(sticks)
	for i in range(l):
		sticks[i - 1] -= x
	sticks[:] = [x for x in sticks if x != 0]
	l = len(sticks)


arr = []
rem = []
N = int(input())
for i in input().split():
	arr = arr + [int(i)]
rem = arr
while len(rem) > 0:
	mini = min(rem)
	cut = 0
	rem = []
	for i in range(len(arr)):
		if arr[i] >= mini:
			cut = cut + 1
			if arr[i] > mini:
				rem = rem + [arr[i] - mini]
	arr = rem
	print(cut)


n = int(input())
s = input()
a = []
for str in s.split():
	a.append(int(str))
m = n
print(m)
a.sort()
x = a[0]
for i in range(0, n):
	if x == a[i]:
		m -= 1
	elif m > 0:
		print(m)
		x = a[i]
		m -= 1


n = int(input())
sticks = [int(i) for i in str(input()).split()]
while len(sticks) > 0:
	cut = min(sticks)
	for i in range(len(sticks)):
		sticks[i] -= cut
	print(len(sticks))
	sticks = [i for i in sticks if i > 0]


n = int(input())
s = input()
a = []
for str in s.split():
	a.append(int(str))
smallest = a[0]
biggest = a[0]
for i in a:
	if smallest > i:
		smallest = i
	if biggest < i:
		biggest = i
while biggest > 0:
	ans = 0
	smallest = 99999
	for i in a:
		if smallest > i and i > 0:
			smallest = i
	biggest = biggest - smallest
	for i in range(0, n):
		if a[i] > 0:
			ans = ans + 1
		a[i] = a[i] - smallest
	if ans != 0:
		print(ans)


numSticks = int(input())
stickArray = [int(i) for i in input().strip().split()]
while len(stickArray) > 0:
	temp = []
	minLen = min(stickArray)
	print(len(stickArray))
	for eachStick in stickArray:
		if eachStick > minLen:
			temp.append(eachStick - minLen)
	stickArray = temp


n = int(input(''))
a = input('')
a1 = []
count = 0
for j in range(len(a)):
	if a[j] == ' ':
		a1.append(int(a[j - count:j]))
		count = 0
	elif j == len(a) - 1:
		a1.append(int(a[j - (count - 1):j + 1]))
	count = count + 1
while len(a1) > 0:
	temp = []
	for i in range(len(a1)):
		if a1[i] - min(a1) != 0:
			temp.append(a1[i])
	print(len(a1))
	a1 = temp


N = int(input())
sticks_array = [int(stick) for stick in input().split()]
sticks_len = len(sticks_array)
while True:
	sticks_small = sticks_array[0]
	for i in range(sticks_len):
		if sticks_array[i] < sticks_small:
			sticks_small = sticks_array[i]
	for j in range(sticks_len):
		sticks_array[j] -= sticks_small
	sticks_array = list(filter(lambda stick: stick != 0, sticks_array))
	print(sticks_len)
	sticks_len = len(sticks_array)
	if sticks_len == 0:
		break


N = int(input())
s = input()
lens = [int(n) for n in s.split()]
while len(lens) > 0:
	t = min(lens)
	for i in range(len(lens)):
		lens[i] = lens[i] - t
	print(len(lens))
	while 0 in lens:
		lens.remove(0)
	if len(lens) == 1:
		print(len(lens))
		break


N = int(input())
bob = input()
sticks = bob.split(' ')
for i in range(N):
	sticks[i] = int(sticks[i])
while len(sticks) != 0:
	small = min(sticks)
	print(len(sticks))
	for i in range(sticks.count(small)):
		sticks.remove(small)


import sys
lines = [_.rstrip('\n') for _ in sys.stdin.readlines()]
sticks = [int(_) for _ in lines[1].split()]
while sticks:
	old_len = len(sticks)
	first = min(sticks)
	sticks = [stick - first for stick in sticks if stick > first]
	if len == old_len:
		print('DONE')
		break
	else:
		print(old_len)


N = int(input())
a = list(map(int, input().strip().split()))
a.sort()
last = 0
for (i, e) in enumerate(a):
	if last < e:
		print(N - i)
		last = e


n = int(input())
data = [int(x) for x in input().split(' ')]
while data:
	print(len(data))
	Min = min(data)
	new_data = []
	for x in data:
		if x - Min > 0:
			new_data.append(x - Min)
	data = new_data


def solve(sticks):
	while len(sticks) > 0:
		m = min(sticks)
		print(len(sticks))
		sticks = list(map(lambda x: x - m, sticks))
		sticks = list(filter(lambda x: x > 0, sticks))
input()
solve(list(map(int, input().split(' '))))


n = int(input())
assert n <= 1000 and n >= 1
a = input()
a = a.split()
a = list(map(int, a))
l = len(a)
while l >= 1:
	print(l)
	m = min(a)
	i = 0
	while i < len(a):
		if a[i] == m:
			del a[i]
			i = i - 1
		else:
			a[i] = a[i] - m
		i += 1
	l = len(a)


def run():
	input()
	sticks = list(map(int, input().split(' ')))
	while len(sticks) > 0:
		print(len(sticks))
		m = min(sticks)
		sticks = [s - m for s in sticks if s - m > 0]
run()


number_of_sticks = int(input())
sticks_and_length = [int(x) for x in input().split()]
while number_of_sticks > 0:
	print(number_of_sticks)
	minimum_size = min(sticks_and_length)
	sticks_and_length = [x - minimum_size for x in sticks_and_length]
	number_of_sticks -= sticks_and_length.count(0)
	sticks_and_length = [x for x in sticks_and_length if x != 0]


num = int(input())
s = input()
sticks = [int(i) for i in s.split(' ')]
while len(sticks):
	lowest = min(sticks)
	sticks = [elem - lowest for elem in sticks]
	print(len(sticks))
	sticks = [elem for elem in sticks if elem > 0]


number_of_sticks = int(input())
sticks_str = str(input()).split(' ')
sticks_int = []
new_min_stick = 999999999
for stick in sticks_str:
	sticks_int.append(int(stick))
	if int(stick) < new_min_stick:
		new_min_stick = int(stick)
while len(sticks_int) > 0:
	min_stick = new_min_stick
	new_min_stick = 999999999
	print(len(sticks_int))
	for i in range(len(sticks_int)):
		sticks_int[i] = sticks_int[i] - min_stick
		if sticks_int[i] != 0 and sticks_int[i] < new_min_stick:
			new_min_stick = sticks_int[i]
	sticks_int = list(filter(lambda a: a != 0, sticks_int))


N = int(input())
array_ = input().split(' ')
array_ = [int(x) for x in array_]
while len(array_) > 0:
	minElement = min(array_)
	print(len(array_))
	array_ = [x - minElement for x in array_ if x - minElement != 0]


import sys
s = input()
nums = input()
no = [int(i) for i in nums.split(' ')]
while no:
	print(len(no))
	no[:] = [x - min(no) for x in no]
	no = [x for x in no if x != 0]


import sys
s = input()
nums = input()
no = [int(i) for i in nums.split(' ')]
while no:
	print(len(no))
	no[:] = [x - min(no) for x in no]
	no = [x for x in no if x != 0]


(n, prev) = (int(input()), 0)
for (i, a) in enumerate(sorted((int(x) for x in input().split()))):
	if a != prev:
		print(n - i)
	prev = a


N = int(input())
a = []
a = [int(i) for i in input().split()]
a.sort()
while a:
	b = a[0]
	print(len(a))
	a = [j - b for j in a]
	while a.count(0):
		a.remove(0)


num = int(input())
sticks = map(int, input().split())
val = [0] * 1001
for i in sticks:
	val[i] += 1
counter = 0
val = val[::-1]
ans = []
for i in val:
	if i > 0:
		counter += i
		ans.append(counter)
ans = ans[::-1]
for i in ans:
	print(i)


num_sticks = int(input())
sticks = list(map(int, input().rstrip().split(' ')))
while sticks:
	print(len(sticks))
	min_stick = min(sticks)
	sticks = [stick - min_stick for stick in sticks if stick - min_stick > 0]


n = int(input())
sticks = input().split()
sticks = [int(i) for i in sticks]
while len(sticks) != 0:
	print(len(sticks))
	minimum = min(sticks)
	sticks = [x - minimum for x in sticks]
	while 0 in sticks:
		sticks.remove(0)


n = int(input())
sticks = list((int(x) for x in input().split(' ')))
while len(sticks) > 0:
	print(len(sticks))
	m = min(sticks)
	sticks = [i - m for i in sticks]
	sticks = [i for i in sticks if i > 0]


def cutTheSticks(sticks):
	while len(sticks) > 0:
		cut = min(sticks)
		count = 0
		result = []
		for stick in sticks:
			rem = stick - cut
			if rem > 0:
				count += 1
				result.append(rem)
			elif rem == 0:
				count += 1
		print(count)
		sticks = result
n = int(input())
sticks = [int(i) for i in input().split(' ')]
cutTheSticks(sticks)


noOfSticks = input()
stickList = input().split(' ')
stickList = [int(stick) for stick in stickList]
while len(stickList):
	stickList.sort()
	cutLen = int(stickList[0])
	remSticks = len(stickList)
	k = 0
	for i in range(0, len(stickList)):
		stickList[k] -= cutLen
		if stickList[k] <= 0:
			del stickList[k]
			k = k - 1
		k += 1
	print(remSticks)


def f(A):
	A.sort()
	i = 0
	while i < len(A):
		print(len(A) - i)
		while i + 1 < len(A) and A[i + 1] == A[i]:
			i += 1
		i += 1
input()
f([int(i) for i in input().split()])


N = int(input())
list_a = list(map(int, input().split()))
print(len(list_a))
while len(list_a) > 1:
	minimum = min(list_a)
	new_list = []
	for count in range(len(list_a)):
		if list_a[count] != minimum:
			new_list.append(list_a[count])
	if len(new_list) == 0:
		break
	print(len(new_list))
	list_a = []
	for i in new_list:
		list_a.append(i)


def cut(sticks):
	history = []
	while sticks:
		smallest = min(sticks)
		history.append(len([s for s in sticks if s >= smallest]))
		sticks = [s - smallest for s in sticks if s > smallest]
	return history
_ = input()
cuts = map(str, cut([int(i) for i in input().split()]))
print('\n'.join(cuts))


N = input()
num = map(int, input().split())
val = [0] * 1001
for i in num:
	val[i] += 1
counter = 0
val = val[::-1]
ans = []
for i in val:
	if i > 0:
		counter += i
		ans.append(counter)
ans = ans[::-1]
for i in ans:
	print(i)


input()
sticks = input().split(' ')
sticks = [int(x) for x in sticks]
while len(sticks) > 0:
	print(len(sticks))
	l = min(sticks)
	i = 0
	while i < len(sticks):
		sticks[i] -= l
		if sticks[i] <= 0:
			del sticks[i]
		else:
			i += 1


def cut(lst):
	if len(lst) == 0:
		return
	print(len(lst))
	values = [val - lst[0] for val in lst if val - lst[0] > 0]
	cut(values)
number_of_inputs = int(input())
values = sorted([int(val) for val in input().split(' ')])
assert len(values) == number_of_inputs
cut(values)


def cutTheSticks(sticks):
	while len(sticks):
		print(len(sticks))
		sticks = [i - min(sticks) for i in sticks if i > min(sticks)]
garbage = input()
sticks = [int(i) for i in input().split(' ')]
cutTheSticks(sticks)


number_of_sticks = int(input())
sticks = list(map(int, input().split()))

def verify_stick(stick):
	if stick > 0:
		return True
while len(sticks) > 0:
	length_of_cut = min(sticks)
	sticks_cut = len(sticks)
	print(sticks_cut)
	sticks = list(map(lambda x: x - length_of_cut, sticks))
	sticks = list(filter(verify_stick, sticks))


N = input()
N = int(N)
astr = input().split()
alist = list(astr)
a = []
for i in range(N):
	a.append(int(alist[i]))
while len(a) > 0:
	print(len(a))
	smalleststick = min(a)
	a = map(lambda x: x - smalleststick, a)
	a = list(filter(lambda x: x > 0, a))