Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most x_{i} boxes on its top (we'll call x_{i} the strength of the box). 

Since all the boxes have the same size, Ciel cannot put more than one box directly on the top of some box. For example, imagine Ciel has three boxes: the first has strength 2, the second has strength 1 and the third has strength 1. She cannot put the second and the third box simultaneously directly on the top of the first one. But she can put the second box directly on the top of the first one, and then the third box directly on the top of the second one. We will call such a construction of boxes a pile.[Image]

Fox Ciel wants to construct piles from all the boxes. Each pile will contain some boxes from top to bottom, and there cannot be more than x_{i} boxes on the top of i-th box. What is the minimal number of piles she needs to construct?


-----Input-----

The first line contains an integer n (1 ≤ n ≤ 100). The next line contains n integers x_1, x_2, ..., x_{n} (0 ≤ x_{i} ≤ 100).


-----Output-----

Output a single integer — the minimal possible number of piles.


-----Examples-----
Input
3
0 0 10

Output
2

Input
5
0 1 2 3 4

Output
1

Input
4
0 0 0 0

Output
4

Input
9
0 1 0 2 0 1 1 2 10

Output
3



-----Note-----

In example 1, one optimal way is to build 2 piles: the first pile contains boxes 1 and 3 (from top to bottom), the second pile contains only box 2.[Image]

In example 2, we can build only 1 pile that contains boxes 1, 2, 3, 4, 5 (from top to bottom).[Image]

Source: codeforces | Difficulty: MEDIUM
Tags: Sorting

Greedy algorithms


Solutions:
from collections import Counter

def check(arr):
	l = len(arr)
	for i in range(len(arr)):
		if l - i - 1 > arr[i]:
			return False
	return True

def boredom(arr):
	arr = sorted(arr, reverse=True)
	for ans in range(1, len(arr) + 1):
		d = {}
		ind = 0
		for i in arr:
			d[ind] = d.get(ind, []) + [i]
			ind += 1
			ind %= ans
		flag = False
		for i in d.keys():
			if check(d[i]) == False:
				flag = True
				break
		if flag == False:
			return ans
a = input()
lst = list(map(int, input().strip().split()))
print(boredom(lst))


input()
print(max([(ind + 1) // (i + 1) + ((ind + 1) % (i + 1) != 0) for (ind, i) in enumerate(sorted(map(int, input().split())))]))


n = int(input())
a = sorted(map(int, input().split()))
c = 0
for i in range(n):
	if (a[i] + 1) * c <= i:
		c += 1
print(c)


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def MOD():
	return pow(10, 9) + 7

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
import math
n = INI()
X = sorted(INL())
ans = 1
for _ in range(n):
	if X[_] < _ // ans:
		ans += 1
OPS(ans)


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
l = list(map(int, input().split(' ')))
l.sort()
x = [0]
for i in range(n):
	added = False
	for j in range(len(x)):
		if l[i] >= x[j]:
			added = True
			x[j] += 1
			break
	if not added:
		x.append(1)
print(len(x))


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
for i in range(1, n + 1):
	temp = []
	l = n - 1
	for j in range(i):
		temp.append(arr[l])
		l -= 1
	boo = True
	while l >= 0 and boo:
		boo = False
		for j in range(i):
			if temp[j] > 0:
				boo = True
				temp[j] = min(temp[j] - 1, arr[l])
				l -= 1
	if l < 0:
		print(i)
		break


input()
print(1 + max((x // -~f for (x, f) in enumerate(sorted(map(int, input().split()))))))


n = int(input())
x = list(map(int, input().split()))
x.sort()
nu = 0
ans = 0
mark = []
for i in range(0, n):
	mark.append(0)
for i in range(0, n):
	fail = 1
	nu = 0
	for j in range(0, n):
		if mark[j] == 0:
			fail = 0
			if x[j] >= nu:
				nu += 1
				mark[j] = 1
	if fail == 0:
		ans += 1
	else:
		break
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
x = []
for i in range(n):
	c = 0
	for j in range(len(x)):
		if x[j] <= a[i]:
			c = 1
			x[j] += 1
			break
	if not c:
		x.append(1)
print(len(x))


n = int(input())
l = sorted(map(int, input().split()))
(pile, box) = (0, n)
visited = [0] * n
while box != 0:
	t = 0
	for i in range(n):
		if l[i] >= t and visited[i] == 0:
			visited[i] = 1
			t += 1
			box -= 1
	if t > 0:
		pile += 1
print(pile)


n = int(input())
a = list(map(int, input().split()))
a.sort()
visited = [0] * n
i = 0
res = 0
while i < n:
	if visited[i] == 0:
		visited[i] = 0
		j = i
		c = 0
		while j < n:
			if a[j] >= c and visited[j] == 0:
				visited[j] = 1
				c += 1
			j += 1
		res += 1
	i += 1
print(res)


def check(a, x):
	for i in range(len(a)):
		if a[i] < len(a) - i:
			return False
	return True
n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
piles = []
for i in a:
	if len(piles) == 0:
		piles.append([i])
	else:
		flg = 1
		for j in range(len(piles)):
			if len(piles[j]) <= i:
				piles[j].append(i)
				flg = 0
				break
		if flg:
			piles.append([i])
print(len(piles))


n = int(input())
a = list(map(int, input().split()))
c = [0 for i in range(101)]
for val in a:
	c[val] += 1
ans = c[0]
leftover = 0
for val in range(1, 101):
	if c[val] <= leftover:
		leftover -= c[val]
		leftover += ans
	elif c[val] <= ans + leftover:
		left_val = c[val] - leftover
		leftover = ans - left_val
	else:
		extra = c[val] - (ans + leftover)
		r = extra % (val + 1)
		q = extra // (val + 1)
		if r == 0:
			leftover = 0
			ans += q
		else:
			leftover = val + 1 - r
			ans += q + 1
print(ans)


import heapq
import sys
input = sys.stdin.readline
for _ in range(1):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.sort()
	temp = []
	for i in arr:
		f = False
		for k in range(len(temp)):
			if temp[k] <= i and i != 0:
				f = True
				temp[k] += 1
				break
		if f == False:
			temp.append(1)
	print(len(temp))


n = int(input())
a = list(map(int, input().split()))
a.sort()
piles = 0
for i in range(n):
	if piles * (a[i] + 1) <= i:
		piles += 1
print(piles)


n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
while len(l):
	s = []
	b = 0
	for i in range(len(l)):
		if b <= l[i]:
			b = b + 1
		else:
			s.append(l[i])
	ans = ans + bool(b)
	l = s
print(ans)


n = int(input())
l = [*map(int, input().split())]
l.sort()
spen = 0
ans = 0
while spen < n:
	x = 0
	for i in range(n):
		if l[i] >= x:
			x += 1
			spen += 1
			l[i] = -10 ** 3
	ans += 1
print(ans)


from bisect import bisect_left
input()
s = []
for i in sorted(map(int, input().split())):
	k = bisect_left(s, -i)
	if k == len(s):
		s.append(-1)
	else:
		s[k] -= 1
print(len(s))


def go():
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	a.sort()
	o = 1
	for i in range(n):
		if a[i] < i // o:
			o += 1
	return o
print(go())


import math
n = int(input())
lst = list(map(int, input().strip().split(' ')))
lst.sort()
pc = 0
stc = 0
j = 0
f = 0
while len(lst) != 0:
	if f == 0:
		del lst[0]
		stc = 1
		f = 1
	else:
		f = 1
		if j >= len(lst):
			j = 0
			f = 0
			pc += 1
		elif lst[j] >= stc:
			del lst[j]
			stc += 1
		else:
			j += 1
print(pc + 1)


n = int(input())
a = [int(i) for i in input().split(' ')]
a.sort()
s = 1
for i in range(n):
	if a[i] < i // s:
		s += 1
print(s)


n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 0
for i in range(n):
	cnt = i + 1
	lvl = a[i] + 1
	res = max(res, (cnt + lvl - 1) // lvl)
print(res)


n = int(input())
pile = [int(x) for x in input().split()]
pile.sort()
res = 1
for i in range(n):
	if pile[i] < i // res:
		res += 1
print(res)


def isPossible(arr, pile):
	arr.sort(reverse=True)
	size = [10 ** 18] * pile
	c = 0
	for item in arr:
		if size[c % pile] >= 1:
			size[c % pile] = min(size[c % pile] - 1, item)
		else:
			return False
		c = c + 1
	return True
n = int(input())
arr = [int(num) for num in input().split(' ')]
ans = n
while ans >= 1:
	if isPossible(arr, ans) == True:
		res = ans
	else:
		break
	ans = ans - 1
print(res)


import bisect
n = int(input())
xi = list(sorted(map(int, input().split())))
s = set(xi)
li = []
while len(xi) > 0:
	li.append([xi.pop(0)])
	i = 0
	while i < len(xi):
		if xi[i] >= len(li[-1]):
			li[-1].append(xi.pop(i))
		else:
			i += 1
print(len(li))


def main():
	n = int(input())
	l = sorted(map(int, input().split()))
	res = 0
	while l:
		res += 1
		(i, l1) = (0, [])
		for x in l:
			if x < i:
				l1.append(x)
			else:
				i += 1
		l = l1
	print(res)
main()


n = int(input())
a = sorted(map(int, input().split()), reverse=True)

def ok(cnt):
	stacks = [[] for _ in range(cnt)]
	for (i, val) in enumerate(a):
		stacks[i % cnt].append(val)
	for stack in stacks:
		for (i, val) in enumerate(stack):
			if val < len(stack) - i - 1:
				return False
	return True
for i in range(1, n + 1):
	if ok(i):
		print(i)
		exit()
raise Exception


n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0]
for i in a:
	add = False
	for j in range(len(dp)):
		if dp[j] <= i:
			dp[j] += 1
			add = True
			break
	if not add:
		dp.append(1)
print(len(dp))


import sys
input = sys.stdin.readline
read_tuple = lambda _type: map(_type, input().split(' '))

def is_correct(seq):
	if len(seq) == 1:
		return True
	_len = 1
	res = True
	for idx in range(1, len(seq)):
		res = res and seq[idx] >= _len
		_len += 1
	return res

def solve():
	n = int(input())
	x = list(read_tuple(int))
	x.sort(reverse=True)
	ans = 0
	while x:
		stack = [x.pop()]
		while x:
			added = False
			for i in range(len(x) - 1, -1, -1):
				if is_correct(stack + [x[i]]):
					stack.append(x[i])
					x.pop(i)
					added = True
					break
			if not added:
				break
		ans += 1
	print(ans)
solve()


import math
from decimal import *
getcontext().prec = 30
n = int(input())
x = list(map(int, input().split()))
x.sort()
l = list()
for i in range(len(x)):
	added = 0
	for j in range(len(l)):
		if x[i] >= len(l[j]):
			l[j].append(x[i])
			added = 1
			break
	if not added:
		v = [x[i]]
		l.append(v)
print(len(l))


n = int(input())
a = sorted(list(map(int, input().split())))
ans = 1
height = 1
box = min(a)
a.remove(box)
while len(a) > 0:
	dif = float('inf')
	for boxes in a:
		if boxes >= height:
			if boxes - height < dif:
				box = boxes
				dif = boxes - height
	if dif == float('inf'):
		ans += 1
		box = min(a)
		a.remove(box)
		height = 1
	else:
		a.remove(box)
		height += 1
print(ans)


def check(mid, lis):
	pile = [10000000000] * mid
	c = 0
	for i in range(n - 1, -1, -1):
		pile[i % mid] = min(pile[i % mid] - 1, lis[i])
	if min(pile) < 0:
		return 0
	else:
		return 1
n = int(input())
lis = sorted(map(int, input().split()))
l = 1
r = n
while l <= r:
	mid = l + (r - l) // 2
	if check(mid, lis):
		r = mid - 1
	else:
		l = mid + 1
print(l)


from sys import stdin
inFile = stdin
tokens = []
tokens_next = 0

def next_str():
	nonlocal tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = inFile.readline().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())

def check(a, n):
	if n == 0:
		return 0
	if len(a) <= n:
		return 1
	l = [[i] for i in a[:n]]
	allowed = [i for i in a[:n]]
	ind = 0
	for i in a[n:]:
		ind += 1
		ind %= len(allowed)
		starting_pos = ind
		while allowed[ind] == 0:
			ind += 1
			ind %= len(l)
			if ind == starting_pos:
				return 0
		l[ind] += [i]
		allowed[ind] = min(i, allowed[ind] - 1)
	return 1

def solve(a):
	a.sort(reverse=1)
	n = len(a)
	low = 0
	high = n
	while low + 1 < high:
		m = (low + high) // 2
		if check(a, m):
			high = m
		else:
			low = m
	return high
n = nextInt()
a = [nextInt() for i in range(n)]
print(solve(a))


import sys
import math
n = int(sys.stdin.readline())
xn = [int(x) for x in sys.stdin.readline().split()]
xn.sort()
k = [1]
res = 1
for i in xn[1:]:
	flag = False
	for t in range(res):
		if i >= k[t]:
			k[t] += 1
			flag = True
			break
	if flag == False:
		res += 1
		k.append(1)
print(res)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
l = sorted(I())
an = 1
c = 1
cr = l[0]
i = 1
while i < n:
	if l[i] > l[i - 1]:
		an = max(an, (c + cr) // (cr + 1))
		cr = l[i]
	c += 1
	i += 1
an = max(an, (c + cr) // (cr + 1))
print(an)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
(unq, ans, req) = (set(arr), 1, 0)
for ele in unq:
	count = arr.count(ele)
	req += count
	if req // (ele + 1) != req / (ele + 1):
		ans = max(1 + req // (ele + 1), ans)
	else:
		ans = max(req // (ele + 1), ans)
print(ans)


a = int(input())
z = list(map(int, input().split()))
from bisect import *
z.sort()
index = 0
count = 0
while len(z):
	r = bisect_left(z, index)
	if r == len(z):
		count += 1
		index = 0
	else:
		index += 1
		z.pop(r)
print(count + 1)


def main():
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	get = lambda : [int(x) for x in (f.readline() if mode == 'file' else input()).split()]
	[n] = get()
	a = get()
	a.sort()
	p = [[]]
	p[0].append(a[0])
	for i in a[1:]:
		p = sorted(p, key=lambda x: len(x))
		p.reverse()
		found = False
		for j in p:
			if len(j) <= i:
				j.append(i)
				found = True
				break
		if found == False:
			p.append([i])
	print(len(p))
	if mode == 'file':
		f.close()
main()


n = int(input())
l = list(map(int, input().split(' ')))
l.sort()
nb = 0
for i in range(n):
	if l[i] == -1:
		continue
	h = 1
	nb += 1
	for j in range(i + 1, n):
		if l[j] >= h:
			h += 1
			l[j] = -1
print(nb)


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
ans = []
for ele in arr:
	for i in range(len(ans)):
		if ans[i] <= ele:
			ans[i] += 1
			break
	else:
		ans.append(1)
print(len(ans))


n = int(input())
boxes = list(map(int, input().split()))
cont = 1
i = 1
boxes.sort()
for i in range(n):
	if i // cont > boxes[i]:
		cont = cont + 1
print(cont)


from sys import stdin, stdout
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, input().split()))
for _ in range(1):
	n = nmbr()
	a = sorted(lst())
	ans = 0
	while 1:
		left = []
		cap = 0
		for v in a:
			if v >= cap:
				cap += 1
			else:
				left += [v]
		a = left.copy()
		ans += 1
		if len(left) == 0:
			break
	print(ans)


n = int(input())
l = list(map(int, input().split()))
l.sort()
i = 0
v = [0] * n
out = 0
while i < n:
	if v[i] == 0:
		c = 0
		j = i
		while j < n:
			if l[j] >= c and v[j] == 0:
				v[j] = 1
				c += 1
			j += 1
		out += 1
	i += 1
print(out)


n = int(input())
l = sorted(list(map(int, input().split())))
piles = [None] * 100
for i in range(1, 100):
	piles[i] = []
piles[0] = [l[0]]
i = 1
for j in range(1, n):
	flag = 0
	for k in range(0, i):
		if l[j] >= len(piles[k]):
			piles[k].append(l[j])
			flag = 1
			break
	if flag == 0:
		piles[i] = [l[j]]
		i += 1
print(i)


input()
s = []
for x in sorted(map(int, input().split())):
	if len(s) == 0:
		s.append(1)
	else:
		for i in range(len(s)):
			if x >= s[i]:
				s[i] += 1
				break
		else:
			s.append(1)
print(len(s))


from sys import stdin

def get_freq(arr):
	freq = [0] * 101
	for i in arr:
		freq[i] += 1
	return freq
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
freq = get_freq(arr)
i = 0
c = 0
while i <= 100:
	if freq[i] == 0:
		i += 1
	else:
		freq[i] -= 1
		c += 1
		j = i
		strength = 1
		while j <= 100:
			if j >= strength and freq[j] > 0:
				freq[j] -= 1
				strength += 1
				continue
			j += 1
print(c)


n = int(input())
A = [int(a) for a in input().split()]
A.sort()
piles = 0
for i in range(n):
	if A[i] == -1:
		continue
	size = 1
	A[i] = -1
	for j in range(i + 1, n):
		if A[j] < size:
			continue
		elif A[j] > size:
			size += 1
			A[j] = -1
		elif A[j] == size and A[j] > 0:
			size += 1
			A[j] = -1
		else:
			size += 1
			A[j] = -1
	piles += 1
print(piles)


n = int(input())
a = sorted(list(map(int, input().split())))
used = [False] * (n + 1)
ans = 0
while True:
	pos = -1
	for i in range(n):
		if used[i] == False:
			pos = i
			break
	if pos == -1:
		break
	ans += 1
	total = 1
	used[pos] = True
	for j in range(pos + 1, n):
		if used[j] == False and a[j] >= total:
			total += 1
			used[j] = True
print(ans)


n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
while len(l) != 0:
	A = []
	k = 1
	ans += 1
	for j in range(1, len(l)):
		if l[j] != 0 and l[j] >= k:
			k += 1
		else:
			A.append(l[j])
	l = A
print(ans)


n = int(input())
val = [[]]
for x in sorted((int(x) for x in input().split())):
	for l in val:
		if x >= len(l):
			l.append(x)
			break
	if len(val[-1]) > 0:
		val.append([])
print(len(val) - 1)


n = int(input())
l = [int(x) for x in input().split()]
ans = 0
l.sort()
while l:
	l1 = []
	c = 0
	for i in range(len(l)):
		if l[i] >= c:
			c += 1
		else:
			l1.append(l[i])
	l = l1[:]
	ans += 1
print(ans)


n = input()
h = [0]
A = sorted(map(int, input().split()))
for x in A:
	if x < min(h):
		h += [1]
	else:
		h[h.index(min(h))] += 1
print(len(h))


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
k = 0
for i in range(n):
	if k * (a[i] + 1) <= i:
		k += 1
print(k)


n = int(input())
boxes = [int(x) for x in input().split()]
boxes.sort(reverse=True)
piles = []
while boxes:
	box = boxes.pop()
	for pile in piles:
		if box >= len(pile):
			pile.append(box)
			break
	else:
		piles.append([box])
print(len(piles))


n = int(input())
x = sorted(list(map(int, input().split())))
ans = 1
for i in range(n):
	if x[i] < i // ans:
		ans += 1
print(ans)


(n, required, searched) = (int(input()), 0, [])
boxes = list(sorted([int(i) for i in input().split()]))
while True:
	stack = 0
	for i in range(n):
		if i not in searched and boxes[i] >= stack:
			searched.append(i)
			stack += 1
	if stack:
		required += 1
	else:
		break
print(required)


n = int(input())
ans = 0
li1 = [int(i) for i in input().split()]
li2 = []
while li1:
	li1.sort()
	n = len(li1)
	i = 0
	while i < n:
		if li1[i] < i:
			li2.append(li1[i])
			del li1[i]
			n -= 1
		else:
			i += 1
	ans += 1
	li1 = li2
	li2 = []
print(ans)


n = int(input())
lst = sorted([int(x) for x in input().split()])
pc = stc = j = f = 0
while lst:
	if f == 0:
		del lst[0]
		stc = f = 1
	else:
		f = 1
		if j >= len(lst):
			j = f = 0
			pc += 1
		elif lst[j] >= stc:
			del lst[j]
			stc += 1
		else:
			j += 1
print(pc + 1)


n = int(input())
ar = list(map(int, input().split(' ')))
ar.sort()
s = []
for i in ar:
	s.sort(reverse=True)
	for j in range(len(s)):
		if i >= s[j]:
			s[j] += 1
			break
	else:
		s.append(1)
print(len(s))


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def binary(data, target, low, high):
	if low > high:
		return high
	else:
		mid = int((low + high) / 2)
		if data[mid] > target:
			return binary(data, target, low, mid - 1)
		else:
			return binary(data, target, mid + 1, high)
n = int(input())
l = sorted(map(int, input().split()))
ta = l[n - 1] - 1
res = 1
l.pop()
ko = ta + 1
while len(l) > 0:
	k = binary(l, ta, 0, len(l) - 1)
	if k != -1:
		t = l[k]
		eks = ta - t
		if eks > 0:
			start_ind = k + 1
			for i in range(eks):
				if start_ind < len(l):
					del l[start_ind]
		del l[k]
		ta = t - 1
		ko = ta + 1
	elif ko == 0:
		if len(l) == 0:
			break
		else:
			res += 1
			ta = l[-1] - 1
			ko = ta + 1
			l.pop()
	else:
		k = 0
		del l[k]
		ta -= 1
		ko -= 1
print(res)


n = int(input())
s = [int(c) for c in input().split()]
s.sort()
s.reverse()
ans = 1

def f(a):
	i = 0
	b = True
	while i < len(a) and b:
		if a[i] < len(a) - i - 1:
			b = False
			return b
		i += 1
	return b
while True:
	p = [[] for i in range(ans)]
	i = 0
	while i < n:
		p[i % ans].append(s[i])
		i += 1
	t = 0
	for d in p:
		if f(d):
			t += 1
	if t == len(p):
		print(ans)
		break
	ans += 1


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
u = 0
a = 0
while u < n:
	a += 1
	c = 0
	for i in range(n):
		if l[i] >= c:
			c += 1
			u += 1
			l[i] = -1
print(a)


def mlt():
	return map(int, input().split())
x = int(input())
s = sorted([*mlt()])
res = 0
while len(s):
	tm = []
	cur = 0
	for n in s:
		if cur <= n:
			cur += 1
		else:
			tm.append(n)
	res += int(cur != 0)
	s = tm
print(res)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
arr = lmp()
arr.sort()
mx = 1
ml = [[arr[0]]]
for i in range(1, n):
	t = False
	for j in range(len(ml)):
		if len(ml[j]) <= arr[i]:
			ml[j].append(arr[i])
			t = True
			break
	if not t:
		ml.append([arr[i]])
print(len(ml))


from collections import Counter as cs
n = int(input())
ls = [int(a) for a in input().split()]
ls.sort()
ls1 = dict(cs(ls))
(ctr1, ctr2) = (1, 0)
for i in range(n):
	if ls1[ls[i]]:
		ls1[ls[i]] -= 1
		for j in range(i, n):
			if i != j and ls[j] >= ctr1 and ls1[ls[j]]:
				ctr1 += 1
				ls1[ls[j]] -= 1
		ctr2 += 1
		ctr1 = 1
print(ctr2)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest
INF = 99999999999999999999999999999999

def main():
	mod = 1000000007
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		n = ri()
		x = ria()
		x = sorted(x)
		count = 0
		while x:
			last = x[-1]
			index = {0: 1}
			for i in range(1, len(x)):
				if x[i] >= len(index):
					index[i] = 1
			newx = []
			for i in range(len(x)):
				if i not in index:
					newx.append(x[i])
			x = newx
			count += 1
		wi(count)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


def binary(data, target, low, high):
	if low > high:
		return high
	else:
		mid = int((low + high) / 2)
		if data[mid] > target:
			return binary(data, target, low, mid - 1)
		else:
			return binary(data, target, mid + 1, high)
n = int(input())
l = sorted(map(int, input().split()))
ta = l[n - 1] - 1
res = 1
l.pop()
while len(l) > 0:
	k = binary(l, ta, 0, len(l) - 1)
	if k != -1:
		t = l[k]
		for i in range(ta - l[k]):
			if k < len(l) - 1:
				del l[k + 1]
		del l[k]
		ta = t - 1
	elif ta + 1 == 0:
		if len(l) == 0:
			break
		else:
			res += 1
			ta = l[-1] - 1
			l.pop()
	else:
		k = 0
		del l[k]
		ta -= 1
print(res)


import collections, bisect, heapq
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
t = []
for a in arr:
	if not t or a < t[0]:
		heapq.heappush(t, 1)
	else:
		c = heapq.heappop(t)
		heapq.heappush(t, c + 1)
print(len(t))


n = int(input())
li = sorted([int(x) for x in input().split()])
res = 1
for i in range(n):
	if li[i] < i // res:
		res += 1
print(res)


import time, math, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x))

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 9 + 7

def solve():
	n = II()
	li = L()
	li.sort()
	tot = 1
	ans = 0
	while tot <= n:
		strength = 0
		for i in range(n):
			if li[i] >= strength:
				strength += 1
				li[i] = -999
				tot += 1
		ans += 1
	print(ans)
solve()


from math import inf as inf
from math import *
from collections import *
import sys
input = sys.stdin.readline
t = 1
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	re = a[0]
	s = 0
	for i in range(n):
		if s * (a[i] + 1) <= i:
			s += 1
	print(s)


n = int(input())
a = list(map(int, input().split()))
d = [0] * 101
for i in a:
	d[i] += 1
p = 0
while True:
	allZeros = True
	k = 0
	for i in range(101):
		if d[i] != 0:
			while i >= k and d[i] > 0:
				d[i] -= 1
				k += 1
			allZeros = False
	if allZeros:
		break
	else:
		p += 1
print(p)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def msi():
	return map(str, input().split())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
mod = 1000000007

def modInverse(b, m):
	g = gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def modu(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	if inv == -1:
		return -999999999
	else:
		return inv * a % m
from math import log, factorial, cos, tan, sin, radians, floor, log2
import bisect
from decimal import *
getcontext().prec = 8
abc = 'abcdefghijklmnopqrstuvwxyz'
pi = 3.141592653589793

def gcd1(a):
	if len(a) == 1:
		return a[0]
	ans = a[0]
	for i in range(1, len(a)):
		ans = gcd(ans, a[i])
	return ans

def main():
	for _ in range(1):
		n = ii()
		a = li()
		a.sort()
		f = [0] * n
		ans = 0
		for i in range(n):
			if f[i]:
				continue
			f[i] = 1
			ans += 1
			p = 1
			for j in range(i + 1, n):
				if a[j] >= p and f[j] == 0:
					f[j] = 1
					p += 1
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def fox(lst):
	result = 1
	for i in range(len(lst)):
		if lst[i] < i // result:
			result += 1
	return result
n = int(input())
a = [int(j) for j in input().split()]
print(fox(sorted(a)))


import math
n = int(input())
arr = [int(z) for z in input().split()]
arr.sort()
r = 0
for i in range(n):
	e = arr[i]
	k = math.ceil((i + 1) / (e + 1))
	r = max(r, k)
print(r)


n = int(input())
a = [int(x) for x in input().split()]
v = [True] * n
a.sort()
ans = 0
prev = 0
i = 0
cnt = 0
while cnt < n:
	if a[i] >= prev and v[i]:
		cnt += 1
		v[i] = False
		prev += 1
	i += 1
	if i == n:
		i = 0
		prev = 0
		ans += 1
if prev != 0:
	ans += 1
print(ans)


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
stack = 0
chosen = [False] * n
for i in range(n):
	chosen[i] = False
for i in range(n):
	if chosen[i] == False:
		chosen[i] = True
		stack += 1
		box = 1
		for j in range(i, n):
			if chosen[j] == False and ar[j] >= box:
				chosen[j] = True
				box += 1
print(stack)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	cnt = 0
	while len(a) != 0:
		temp = list(a)
		temp.sort()
		x = 0
		while x < len(temp):
			if temp[x] < x:
				temp.pop(x)
			else:
				x += 1
		cnt += 1
		for x in temp:
			a.remove(x)
	print(cnt)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = map(int, input().split())
x = sorted(list(map(int, input().split())))
piles = 1
current = x.pop(0)
current_size = 1
while x:
	for (i, e) in enumerate(x):
		if e >= current_size:
			current = e
			x.pop(i)
			current_size += 1
			break
	else:
		current = x[0]
		x.pop(0)
		current_size = 1
		piles += 1
print(piles)


n = int(input())
li = list(map(int, input().split(' ', n)[:n]))
li.sort()
ans = 1
for i in range(n):
	if li[i] < i // ans:
		ans += 1
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
(pile, tc) = (0, n)
visited = [0] * n
while tc != 0:
	tt = 0
	for i in range(0, n):
		if a[i] >= tt and visited[i] != 1:
			visited[i] = 1
			tt += 1
			tc -= 1
	if tt > 0:
		pile += 1
print(pile)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
res = 1
for i in range(n):
	if arr[i] < i // res:
		res += 1
print(res)


n = int(input())
ar = list(map(int, input().strip().split(' ')))
ar.sort()
i = 0
li = list()
cnt = [0] * 101
for i in ar:
	cnt[i] += 1
for i in range(101):
	if cnt[i] == 0:
		continue
	if len(li) == 0:
		x = i + 1
		li.extend([x] * (cnt[i] // x))
		if cnt[i] % x != 0:
			li.append(cnt[i] % x)
	else:
		z = len(li)
		for j in range(z):
			x = i - li[j] + 1
			if x < cnt[i]:
				cnt[i] -= x
				li[j] += x
			else:
				li[j] += cnt[i]
				cnt[i] = 0
				break
		if cnt[i] != 0:
			d = cnt[i]
			li.extend([i + 1] * (d // (i + 1)))
			if d % (i + 1) != 0:
				li.append(d % (i + 1))
print(len(li))


N = int(input())
ar = list(map(int, input().split()))
ar.sort()
a = 1
b = 100
while a < b:
	compliant = True
	k = (a + b) // 2
	for i in range(len(ar)):
		if ar[i] < i // k:
			compliant = False
			break
	if compliant:
		b = k
	else:
		a = k + 1
print(b)


n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
vis = [False] * n
counter = 0
ans = 0
while counter < n:
	ans += 1
	init = 0
	for i in range(n - 1, -1, -1):
		if not vis[i] and arr[i] >= init:
			vis[i] = True
			counter += 1
			init += 1
print(ans)


def validate_stack(stack):
	for i in range(len(stack)):
		if stack[i] < len(stack) - i - 1:
			return False
	return True
n = int(input())
box_strength = [int(x) for x in input().split()]
box_strength = sorted(box_strength, reverse=True)
flag = True
ans = 100
for i in range(1, n + 1):
	matrix = [[] for x in range(i)]
	flag = True
	ans = i
	for (idx, j) in enumerate(box_strength):
		matrix[idx % i].append(j)
	for stack in matrix:
		if not validate_stack(stack):
			flag = False
			break
	if flag:
		break
print(ans)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	ans = []
	for i in range(1, n + 1):
		ans = [float('inf') for j in range(i)]
		ind = i - 1
		ff = 1
		for j in range(n - 1, -1, -1):
			maxx = -1
			maxind = -1
			for ind in range(i):
				if ans[ind] > maxx:
					maxx = ans[ind]
					maxind = ind
			ind = maxind
			if ans[ind]:
				ans[ind] = min(ans[ind] - 1, a[j])
			else:
				ff = 0
				break
		if ff:
			break
	print(len(ans))
	return
main()


import math
n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
k = 0
for i in range(n):
	if k * (arr[i] + 1) <= i:
		k += 1
print(k)


def main():
	n = int(input())
	strength = list(map(int, input().split()))
	strengths = {}
	for i in strength:
		if i not in strengths.keys():
			strengths[i] = 1
		else:
			strengths[i] += 1
	boxes = []
	for i in strengths.keys():
		boxes.append([i, strengths[i]])
	boxes.sort()
	piles = []
	piles.append([boxes[0][0]])
	boxes[0][1] -= 1
	for i in range(len(boxes)):
		curr = boxes[i][0]
		count = boxes[i][1]
		while count > 0:
			found = False
			for j in range(len(piles)):
				if count > 0:
					if len(piles[j]) <= curr:
						piles[j].append(curr)
						count -= 1
						found = True
			if not found:
				break
		if count > 0:
			total = count // (curr + 1)
			for j in range(total):
				pile = []
				for k in range(curr + 1):
					pile.append(curr)
				piles.append(pile)
			if count % (curr + 1) != 0:
				pile = []
				for j in range(count % (curr + 1)):
					pile.append(curr)
				piles.append(pile)
	print(len(piles))
main()


from __future__ import division, print_function
import math
import os
import sys
from fractions import *
from sys import *
from io import BytesIO, IOBase
from itertools import *
from collections import *
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def inpu():
	return int(inp())

def regularbracket(t):
	p = 0
	for i in t:
		if i == '(':
			p += 1
		else:
			p -= 1
		if p < 0:
			return False
	else:
		if p > 0:
			return False
		else:
			return True

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def reverse1(string):
	pp = ''
	for i in string[::-1]:
		pp += i
	if pp == string:
		return True
	return False

def reverse2(list1):
	l = []
	for i in list1[::-1]:
		l.append(i)
	if l == list1:
		return True
	return False

def mex(list1):
	p = max(list1) + 1
	for i in range(len(list1)):
		if list1[i] != i:
			p = i
			break
	return p

def sumofdigits(n):
	n = str(n)
	s1 = 0
	for i in n:
		s1 += int(i)
	return s1

def perfect_square(n):
	s = math.sqrt(n)
	if s == int(s):
		return True
	return False

def roman_number(x):
	if x > 15999:
		return
	value = [5000, 4000, 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
	symbol = ['F', 'MF', 'M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
	roman = ''
	i = 0
	while x > 0:
		div = x // value[i]
		x = x % value[i]
		while div:
			roman += symbol[i]
			div -= 1
		i += 1
	return roman

def soretd(s):
	for i in range(1, len(s)):
		if s[i - 1] > s[i]:
			return False
	return True

def countRhombi(h, w):
	ct = 0
	for i in range(2, h + 1, 2):
		for j in range(2, w + 1, 2):
			ct += (h - i + 1) * (w - j + 1)
	return ct

def countrhombi2(h, w):
	return h * h // 4 * (w * w // 4)

def binpow(a, b):
	if b == 0:
		return 1
	else:
		res = binpow(a, b // 2)
	if b % 2 != 0:
		return res * res * a
	else:
		return res * res

def binpowmodulus(a, b, m):
	a %= m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res

def coprime_to_n(n):
	result = n
	i = 2
	while i * i <= n:
		if n % i == 0:
			while n % i == 0:
				n //= i
			result -= result // i
		i += 1
	if n > 1:
		result -= result // n
	return result

def prime(x):
	if x == 1:
		return False
	else:
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		else:
			return True

def luckynumwithequalnumberoffourandseven(x, n, a):
	if x >= n and str(x).count('4') == str(x).count('7'):
		a.append(x)
	elif x < 1000000000000.0:
		luckynumwithequalnumberoffourandseven(x * 10 + 4, n, a)
		luckynumwithequalnumberoffourandseven(x * 10 + 7, n, a)
	return a

def luckynuber(x, n, a):
	p = set(str(x))
	if len(p) <= 2:
		a.append(x)
	if x < n:
		luckynuber(x + 1, n, a)
	return a

def interact(type, x):
	if type == 'r':
		inp = input()
		return inp.strip()
	else:
		print(x, flush=True)

def findTrailingZeros(n):
	count = 0
	while n >= 5:
		n //= 5
		count += n
	return count

def mergeSort(arr):
	if len(arr) > 1:
		mid = len(arr) // 2
		L = arr[:mid]
		R = arr[mid:]
		mergeSort(L)
		mergeSort(R)
		i = j = k = 0
		while i < len(L) and j < len(R):
			if L[i] < R[j]:
				arr[k] = L[i]
				i += 1
			else:
				arr[k] = R[j]
				j += 1
			k += 1
		while i < len(L):
			arr[k] = L[i]
			i += 1
			k += 1
		while j < len(R):
			arr[k] = R[j]
			j += 1
			k += 1
res = set()

def solven(p, l, a, b, n):
	if p > n or l > 10:
		return
	if p > 0:
		res.add(p)
	solven(p * 10 + a, l + 1, a, b, n)
	solven(p * 10 + b, l + 1, a, b, n)

def subsetsUtil(A, subset, index, d):
	print(*subset)
	s = sum(subset)
	d.append(s)
	for i in range(index, len(A)):
		subset.append(A[i])
		subsetsUtil(A, subset, i + 1, d)
		subset.pop(-1)
	return d

def subsetSums(arr, l, r, d, sum=0):
	if l > r:
		d.append(sum)
		return
	subsetSums(arr, l + 1, r, d, sum + arr[l])
	subsetSums(arr, l + 1, r, d, sum)
	return d

def print_factors(x):
	factors = []
	for i in range(1, x + 1):
		if x % i == 0:
			factors.append(i)
	return factors

def calc(X, d, ans, D):
	if len(X) == 0:
		return
	i = X.index(max(X))
	ans[D[max(X)]] = d
	Y = X[:i]
	Z = X[i + 1:]
	calc(Y, d + 1, ans, D)
	calc(Z, d + 1, ans, D)

def main():
	n = inpu()
	l = lis()
	l.sort()
	ans = 1
	for i in range(n):
		if l[i] < i // ans:
			ans += 1
	print(ans)
main()


n = int(input())
a = list(map(int, input().split()))
r = 0
flags = [False] * n
a.sort()
count = 0
for i in range(n):
	if count == n:
		break
	r += 1
	last = -1
	for j in range(n):
		if flags[j]:
			continue
		if a[j] == last:
			continue
		flags[j] = True
		count += 1
		last += 1
print(r)


import math

class CodeforcesTask388ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.boxes = []

	def read_input(self):
		self.n = int(input())
		self.boxes = [int(x) for x in input().split(' ')]

	def process_task(self):
		counts = [self.boxes.count(x) for x in range(max(self.boxes) + 1)]
		constraints = [math.ceil(sum(counts[0:x + 1]) / (x + 1)) for x in range(len(counts))]
		self.result = str(max(constraints))

	def get_result(self):
		return self.result
Solution = CodeforcesTask388ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


import heapq
n = int(input())
boxes = sorted(list(map(int, input().split())))
piles = [1]
for b in boxes[1:]:
	if piles[0] <= b:
		heapq.heappush(piles, heapq.heappop(piles) + 1)
	else:
		heapq.heappush(piles, 1)
print(len(piles))


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
ans = 1
for i in range(n):
	if l[i] < i // ans:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
uni = {}
for elem in a:
	if elem not in uni:
		uni[elem] = 1
	else:
		uni[elem] += 1
piles = []
while len(a) > 0:
	box = a.pop(0)
	if len(piles) == 0:
		piles.append([box])
	else:
		for i in range(len(piles)):
			temp = piles[i]
			if box >= len(temp):
				temp.append(box)
				piles[i] = temp
				break
		else:
			piles.append([box])
print(len(piles))


def take_lightest_box(boxes):
	for i in range(101):
		if i in boxes:
			boxes[i] -= 1
			if boxes[i] == 0:
				del boxes[i]
			return i
piles = []
boxes = {}
input()
tmp = input()
x = [int(i) for i in tmp.split(' ')]
for item in x:
	if item in boxes:
		boxes[item] = boxes[item] + 1
	else:
		boxes[item] = 1
while len(boxes) > 0:
	lightest = take_lightest_box(boxes)
	for pile in piles:
		if len(pile) <= lightest:
			pile.append(lightest)
			break
	else:
		piles.append([lightest])
print(len(piles))


import collections, bisect
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
while arr:
	ans += 1
	k = 1
	arr.pop(0)
	while arr and k <= arr[-1]:
		j = bisect.bisect_left(arr, k)
		arr.pop(j)
		k += 1
print(ans)


I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
l.sort()
ans = 0
i = 0
k = 1
while i < n:
	if l[i] < i // k:
		k += 1
	i += 1
print(k)


N = int(input())
a = list(map(int, input().split()))
a.sort()
k = 1
while True:
	for i in range(len(a)):
		if a[i] < i // k:
			break
	else:
		print(k)
		break
	k += 1


from collections import Counter
I = lambda : list(map(int, input().split()))
(n, a) = (I(), I())
a.sort()
h = [1]
for el in a[1:]:
	mn = min(h)
	if el >= mn:
		h[h.index(mn)] += 1
	else:
		h.append(1)
print(len(h))


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
l = l[::-1]
l1 = [0] * n
k = 0
for i in range(n):
	if l1[i] != 1:
		t = l[i]
		p = 1
		r = 0
		l1[i] == 1
		V = [t]
		for j in range(n):
			if l1[j] == 0 and l[j] < t:
				t = l[j]
				l1[j] = 1
				V.append(t)
				r = r + 1
		for j in range(n - 1, -1, -1):
			if l1[j] != 1:
				if l[j] in V:
					q = V.index(l[j]) + 1
					if len(V) - q + 1 <= l[j]:
						c = 0
						s = -1
						u = len(V) - q + 1
						for e in range(q - 1, -1, -1):
							if V[e] >= u + s:
								s = s + 1
							else:
								c = 1
								break
						if c == 0:
							l1[j] = 1
							V = V[:q - 1] + [l[j]] + V[q - 1:]
		k = k + 1
print(k)


import sys
input = sys.stdin.readline
li = lambda : list(map(int, input().split()))
n = int(input())
x = li()
x.sort()

def solve(n, x, num_piles):
	piles = [x[-i] for i in range(1, num_piles + 1)]
	for i in reversed(range(n - num_piles)):
		xi = x[i]
		best_pile = -1
		best_index = None
		for (i, pile) in enumerate(piles):
			if pile > best_pile and pile > 0:
				best_pile = pile
				best_index = i
		if best_index == None:
			return False
		else:
			piles[best_index] = min(xi, best_pile - 1)
	return True
for i in range(1, n):
	if solve(n, x, i):
		print(i)
		sys.exit()
print(n)