Polycarp wants to train before another programming competition. During the first day of his training he should solve exactly $1$ problem, during the second day — exactly $2$ problems, during the third day — exactly $3$ problems, and so on. During the $k$-th day he should solve $k$ problems.

Polycarp has a list of $n$ contests, the $i$-th contest consists of $a_i$ problems. During each day Polycarp has to choose exactly one of the contests he didn't solve yet and solve it. He solves exactly $k$ problems from this contest. Other problems are discarded from it. If there are no contests consisting of at least $k$ problems that Polycarp didn't solve yet during the $k$-th day, then Polycarp stops his training.

How many days Polycarp can train if he chooses the contests optimally?


-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of contests.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 2 \cdot 10^5$) — the number of problems in the $i$-th contest.


-----Output-----

Print one integer — the maximum number of days Polycarp can train if he chooses the contests optimally.


-----Examples-----
Input
4
3 1 4 1

Output
3

Input
3
1 1 1

Output
1

Input
5
1 1 1 2 2

Output
2

Difficulty: EASY

Solutions:
def get_num():
	return int(input())

def print_arr(arr: list):
	for val in arr:
		print(val)

def read_num_list(k):
	num_str = input()
	return [int(v) for v in num_str.split(' ')]
n = get_num()
problems = read_num_list(n)
problems = sorted(problems)
i = 1
j = 0
while True:
	if j >= len(problems):
		break
	if i <= problems[j]:
		j += 1
		i += 1
	else:
		j += 1
print(i - 1)


n = int(input())
a = sorted([int(i) for i in input().split()])
(i, j) = (1, 0)
while True:
	while j < n and a[j] < i:
		j += 1
	if j == n:
		break
	i += 1
	j += 1
print(i - 1)


from sys import stdin
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().split()))
c = 1
l.sort()
for i in l:
	if i >= c:
		c += 1
print(c - 1)


import sys
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
(x, y) = (0, 1)
for i in range(n):
	if a[i] >= y:
		y += 1
		x += 1
print(x)


n = int(input())
l = list(map(int, input().split()))
l.sort()
a = 0
r = 1
for i in range(0, len(l)):
	if l[i] >= r:
		r += 1
		a += 1
print(a)


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

def choisirProblème(liste, jour):
	i = len(liste) - 1
	while i > -1 and liste[i] < jour:
		i -= 1
	if i == -1:
		return False
	for j in range(len(liste) - i):
		liste.pop()
	return True
j = 0
while choisirProblème(nbProblemes, j + 1):
	j += 1
print(j)


n = int(input())
a = sorted([int(item) for item in input().split()])
k = 1
i = 0
ans = 0
while i < n:
	if a[i] >= k:
		k += 1
		ans += 1
	i += 1
print(k - 1)


n = int(input())
problems = []
problems = list(input().split())
problems = [int(x) for x in problems]
problems.sort()
days = 1
p = 0
for p in problems:
	if p >= days:
		days += 1
print(days - 1)


qtd_contest = int(input())
lista_questoes = list(map(int, input().split()))
cont_contest = 0
cont_quest = 1
lista_questoes.sort()
maior = lista_questoes[-1]
for i in lista_questoes:
	if i >= cont_quest:
		cont_quest += 1
		cont_contest += 1
	elif cont_quest > maior:
		break
print(cont_contest)


from collections import defaultdict
import timeit
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
j = 1
count = 0
for i in arr:
	if i >= j:
		count += 1
		j += 1
print(count)


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


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


n = int(input())
c = [*map(int, input().split())]
c.sort()
k = 0
for e in c:
	if e > k:
		k += 1
print(k)


import math
from decimal import *
import random
n = int(input())
arr = sorted(list(map(int, input().split())))
ans = 0
pnt = 1
for i in range(n):
	if arr[i] >= pnt:
		ans += 1
		pnt += 1
print(ans)


n = input()
l = list(map(int, input().split()))
l = sorted(l)
j = 1
for i in l:
	if i >= j:
		j = j + 1
	else:
		continue
print(j - 1)


n = int(input())
a = sorted(list(map(int, input().split())))
c = 0
for i in a:
	if i > c:
		c += 1
print(c)


n = int(input())
a = sorted(map(int, input().split())) + [0]
(i, j) = (0, -1)
ans = 0
while j < n:
	i += 1
	j += 1
	while j < n and a[j] < i:
		j += 1
print(i - 1)


n = int(input())
s = sorted(map(int, input().split()))
k = 1
ans = 0
for i in s:
	if i >= k:
		ans += 1
		k += 1
print(ans)


def inputSeperator(inputStr):
	return list(map(int, inputStr.split(' ')))
n = input()
contests = sorted(inputSeperator(input()))
dayNumber = 1
for i in range(1, len(contests)):
	if contests[i - 1] <= contests[i] and dayNumber + 1 <= contests[i]:
		dayNumber += 1
print(dayNumber)


n = int(input())
a = sorted([int(i) for i in input().split()])
cnt = 0
cur = 0
for i in range(n):
	if a[i] > cur:
		cur += 1
print(cur)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in arr:
	if i > count:
		count += 1
print(count)


n = int(input())
l = [int(s) for s in input().split()]
l.sort()
i = 0
j = 0
while j < n:
	if l[j] >= i + 1:
		i += 1
	j += 1
print(i)


n = int(input())
ara = list(map(int, input().strip().split()))
ara.sort()
j = 0
cnt = 0
k = 1
for i in range(n):
	if ara[i] >= k:
		cnt += 1
		k += 1
print(cnt)


n = int(input())
l = sorted([int(i) for i in input().split()])
i = 0
k = 1
while i < n:
	if l[i] >= k:
		k += 1
		i += 1
	else:
		i += 1
print(k - 1)


n = int(input())
l = [int(num) for num in input().split()]
l.sort()
k = 1
for i in range(n):
	if l[i] >= k:
		k = k + 1
print(k - 1)


x = int(input())
num = list(map(int, input().split()))
num.sort()
j = 0
i = 1
day = 0
while j < len(num):
	if i <= num[j]:
		day += 1
		i += 1
	j += 1
print(day)


R = lambda : map(int, input().split())
(n, s, c) = (int(input()), sorted(list(R())), 1)
for i in range(n):
	if s[i] >= c:
		c += 1
print(c - 1)


n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
pos = 1
for i in range(0, n):
	if a[i] >= pos:
		pos += 1
print(pos - 1)


input()
a = sorted(list(map(int, input().split())))
c = 1
for i in a:
	if i < c:
		continue
	c += 1
print(c - 1)


n = int(input())
a = map(int, input().split())
a = sorted(a)
count = 0
for (i, p) in enumerate(a):
	if p >= count + 1:
		count += 1
print(count)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
j = 1
ans = 0
for i in range(0, n):
	if a[i] >= j:
		j += 1
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
k = 1
for i in a:
	if i >= k:
		c += 1
		k += 1
print(c)


n = int(input())
l = sorted(map(int, input().split()))
sums = 0
for i in range(n):
	if l[i] > sums:
		sums += 1
print(sums)


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


n = int(input())
y = 1
c = list(map(int, input().split()))
c.sort()
for x in range(0, len(c)):
	if c[x] >= y:
		y += 1
print(y - 1)


K = int(input())
L = list(map(int, input().split()))
k = 0
L.sort()
for i in range(K):
	if L[i] >= k + 1:
		k += 1
print(k)


n = int(input())
problems = sorted([int(x) for x in input().split(' ')])
start = 0
i = 0
while True:
	if i >= n:
		break
	if problems[i] < start:
		break
	if problems[i] >= start + 1:
		start += 1
	i += 1
print(start)


n = int(input())
a = list(map(int, input().strip().split(' ')))
a.sort()
days = 0
j = 1
for i in range(n):
	if a[i] >= j:
		days += 1
		j += 1
print(days)


a = input()
c = list(map(int, input().split()))
c.sort()
temp = 1
cnt = 0
for i in range(len(c)):
	if c[i] >= temp:
		cnt += 1
		temp += 1
print(cnt)


n = int(input())
array = list(map(int, input().split()))
array.sort()
i = 1
for j in range(n):
	if array[j] >= i:
		j += 1
		i += 1
	elif array[j] < i:
		j += 1
print(i - 1)


n = int(input())
a = sorted(map(int, input().split()))
i = 1
for j in range(len(a)):
	if a[j] >= i:
		i += 1
		a[j] = 0
print(i - 1)


from sys import stdin, stdout
inp = stdin.readline
out = stdout.write
n = int(inp())
a = list(map(int, inp().split()))
a.sort()
temp = 1
count = 0
i = 0
while i < n:
	if a[i] >= temp:
		count = count + 1
		temp = temp + 1
	i = i + 1
out(str(count))


import sys

def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	ans = 0
	i = 1
	for x in sorted(a):
		if x >= i:
			ans += 1
			i += 1
	print(ans)
main()


from heapq import heappush, heappop
n = int(input())
ar = list(map(int, input().split()))
pq = []
for elm in ar:
	heappush(pq, elm)
curr = 1
cnt = 0
while pq:
	ce = heappop(pq)
	if ce >= curr:
		cnt += 1
		curr += 1
print(cnt)


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


n = int(input())
ent = list(map(int, input().split()))[:n]
ent.sort()
res = 0
err = 0
index_trav = 0
for i in range(0, n):
	if ent[res + err] > index_trav:
		res += 1
		index_trav += 1
	else:
		err += 1
print(res)


input()
li = [int(i) for i in input().split()]
li.sort()
day = 1
for i in range(len(li)):
	if li[i] >= day:
		day += 1
print(day - 1)


n = int(input())
l = list(map(int, input().split()))
l.sort()
k = 1
c = 0
index = 0
while c == 0:
	cout = 0
	for i in range(index, n):
		if l[i] >= k:
			k += 1
			index = i + 1
			cout = 1
	if cout == 0:
		break
print(k - 1)


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


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
i = 0
ans = 0
while i < len(l1):
	if l1[i] >= ans + 1:
		i += 1
		ans += 1
	else:
		i += 1
print(ans)


number = int(input())
lst = [int(x) for x in str(input()).split()]
days = 0
lst = sorted(lst)
for x in lst:
	if x >= days + 1:
		days += 1
print(days)


import sys
input = sys.stdin.readline
n = int(input())
problems = sorted(map(int, input().split()))
day = 1
i = 0
while i < n:
	while i < n and problems[i] < day:
		i += 1
	if i < n and problems[i] >= day:
		i += 1
		day += 1
print(day - 1)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = sorted(il())
c = 0
j = 1
for i in l:
	if i >= j:
		j += 1
		c += 1
print(c)


import sys, collections
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
arr.sort()
top = 1
for i in range(n):
	if arr[i] >= top:
		top += 1
print(top - 1)


p = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
i = 1
while len(l) != 0:
	if i <= l[-1]:
		i = i + 1
	l.pop()
print(i - 1)


n = int(input())
num_problems_per_contest = sorted([int(i) for i in input().split(' ')])
num_days_trained = 0
for i in num_problems_per_contest:
	if i > num_days_trained:
		num_days_trained += 1
print(num_days_trained)


n = int(input())
a = sorted([int(x) for x in input().split()])
a.reverse()
ans = 0
k = 1
while len(a):
	if a[-1] >= k:
		ans += 1
		k += 1
	a.pop()
print(ans)


a = int(input())
b = input()
c = b.split()
for i in range(a):
	c[i] = int(c[i])
c.sort()
j = 1
for i in range(a):
	if c[i] >= j:
		j = j + 1
print(j - 1)


n = int(input())
xs = list(map(int, input().split()))
xs = sorted(xs)
answer = 0
i = 0
currPtr = 0
while i < len(xs) and currPtr < len(xs):
	if xs[currPtr] >= i + 1:
		answer += 1
		i += 1
	currPtr += 1
print(answer)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
current = 1
days = 0
for x in a:
	if x >= current:
		days += 1
		current += 1
print(days)


N = int(input())
A = input().split()
for i in range(N):
	A[i] = int(A[i])
A.sort()
q = 1
count = 0
for j in range(N):
	if A[j] >= q:
		count += 1
		q += 1
print(count)


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


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
j = 0
for i in l:
	if i > j:
		j += 1
print(j)


n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 1
c = 0
idex = 0
while idex < n:
	if a[idex] >= d:
		c += 1
		d += 1
	idex += 1
print(c)


n = int(input())
arr = list(map(int, input().split(' ')))
arr = sorted(arr)
cnt = 1
for i in arr:
	if cnt <= i:
		cnt += 1
print(cnt - 1)


n = int(input())
line = sorted([int(x) for x in input().split()])
d = 0
day = 1
for i in range(n):
	if line[i] >= day:
		d += 1
		day += 1
	else:
		i += 1
print(d)


import heapq
n = map(int, input().strip())
nums = [int(i) for i in input().strip().split()]
the_set = set()
new_nums = nums
heapq.heapify(new_nums)
ans = 0
i = 1
while True:
	if new_nums == []:
		break
	next_val = heapq.heappop(new_nums)
	if next_val >= i:
		ans = i
		i += 1
print(ans)


n = int(input())
cs = [int(t) for t in input().split()]
cs = sorted(cs)
i = 0
days = 0
while i < n:
	if cs[i] >= days + 1:
		days += 1
	i += 1
print(days)


n = int(input())
a = sorted(map(int, input().split()))
r = 0
for v in a:
	if v > r:
		r += 1
print(r)


n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
count = 0
i = 0
day = 1
while i < n:
	if day <= arr[i]:
		count += 1
		day += 1
	i += 1
print(count)


n = int(input())
a = sorted(map(int, input().split()))
p = 0
for x in range(n):
	if a[x] > p:
		p += 1
print(p)


n = int(input())
answer = 1
for elem in sorted(list(map(int, input().split()))):
	if elem >= answer:
		answer += 1
print(answer - 1)


n = int(input())
(*a,) = map(int, input().split())
s = 1
for i in sorted(a):
	if i >= s:
		s += 1
print(s - 1)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
ct = 1
ans = 0
for i in a:
	if i < ct:
		continue
	ans += 1
	ct += 1
print(ans)


N = int(input())
arr = input()
arr = [int(num) for num in arr.split(' ')]
arr.sort()
ans = 1
for i in range(1, N):
	ans += 1
	if arr[i] < ans:
		ans -= 1
print(ans)


def training(n, contests):
	contests.sort()
	day = 1
	i = 0
	while i < n:
		if day <= contests[i]:
			day += 1
			i += 1
		else:
			i += 1
	return day - 1
print(training(int(input()), list(map(int, input().split()))))


n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
cur = 1
i = 0
t = 0
while i < n:
	if a[i] >= cur:
		ans += 1
		cur += 1
	i += 1
print(ans)


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


n = int(input())
arr = sorted([int(p) for p in input().split()])
count = 0
i = 0
k = 1
while i < len(arr):
	if arr[i] >= k:
		count += 1
		i += 1
		k += 1
	else:
		i += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
prob = 1
res = 0
for x in a:
	if x < prob:
		continue
	else:
		res += 1
		prob += 1
print(res)


n = int(input())
ch = input()
l = list(map(int, ch.split()))
l.sort()
i = 0
nbr = 0
v = 1
for i in range(n):
	if l[i] >= v:
		nbr = nbr + 1
		v = v + 1
print(nbr)


n = int(input())
a = list(map(int, input().split(' ')))
a = list(sorted(a))
days_of_training = 0
for i in range(len(a)):
	if a[i] > days_of_training:
		days_of_training += 1
print(days_of_training)


n = int(input())
lst = sorted(list(map(int, input().split())))
i = 0
a = 1
count = 0
while i < n:
	if lst[i] >= a:
		lst[i] = 0
		count += 1
		a += 1
	else:
		i += 1
print(count)


n = int(input())
a = [int(s) for s in input().split()]
a.sort()
i = 0
k = 1
while i < n:
	if a[i] >= k:
		i += 1
		k += 1
	else:
		i += 1
print(k - 1)


n = int(input())
arr = list(map(int, input().split()))
count = 1
c = 0
arr.sort()
for x in arr:
	if x >= count:
		count += 1
		c += 1
print(c)


n = int(input())
problems = list(map(int, input().split()))
problems.sort()
i = 1
j = 0
count = 0
while j < n:
	if problems[j] >= i:
		count += 1
		i += 1
	j += 1
print(count)


n = int(input())
l = sorted(list(map(int, input().split())))
i = 1
base = 1
ans = 0
while i <= len(l):
	if l[i - 1] >= base:
		base = base + 1
		ans = ans + 1
		i = i + 1
	else:
		i = i + 1
print(ans)


from operator import itemgetter
from collections import Counter
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
n = ii()
l = sorted(li())
pos = 1
for i in l:
	if i >= pos:
		pos += 1
print(pos - 1)


def main():
	n = int(input())
	contests = list(map(int, input().split()))
	contests.sort()
	days = 0
	for i in range(n):
		if contests[i] > days:
			days += 1
	print(days)
main()


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = self.next_line()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_line(self):
		return sys.stdin.readline().split()

	def next_ints(self):
		return [int(x) for x in sys.stdin.readline().split()]

	def next_int(self):
		return int(self.next())

	def solve(self):
		n = self.next_int()
		x = sorted(self.next_ints())
		res = 0
		for _x in x:
			if _x > res:
				res += 1
		print(res)
Main().solve()


from sys import stdin
input = stdin.readline
n = int(input())
c = list(map(int, input().split()))
c.sort()
(k, d) = (1, 0)
for num in c:
	if k <= num:
		k += 1
		d += 1
print(d)


n = int(input())
a = sorted(list(map(int, input().split())), key=lambda x: -x)
k = 1
while a:
	if a[-1] >= k:
		k += 1
	a.pop()
print(k - 1)


n = int(input())
a = list(map(int, input().strip().split(' ')))
a.sort()
i = 0
count = 1
while i < n:
	if a[i] >= count:
		count += 1
	i += 1
	if count > a[n - 1]:
		break
print(count - 1)


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


def solve():
	N = int(input())
	A = [int(k) for k in input().split()]
	A.sort()
	ans = 0
	(i, j) = (0, 0)
	while j < N:
		if A[j] >= i + 1:
			ans = i + 1
			i += 1
		j += 1
	print(ans)
solve()


input()
p = list(sorted(map(int, input().split())))
n = 1
for i in p:
	if i >= n:
		n += 1
print(n - 1)


n = int(input())
arr = [int(x) for x in input().split(' ')]
arr.sort()
count = 0
for i in range(len(arr)):
	if arr[i] >= count + 1:
		count += 1
print(count)


n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
x = 1
for num in l:
	if num >= x:
		ans += 1
		x += 1
print(ans)


number = input()
problems = list(map(int, input().split()))
problems.sort()
count = 0
for problem in problems:
	if problem > count:
		count += 1
print(count)


N = int(input())
V = list(map(int, input().split()))
V.sort()
last_day = 0
ans = 0
for Vi in V:
	if last_day < Vi:
		last_day = last_day + 1
print(last_day)


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

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

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

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

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def solve():
	n = int(input())
	arr = sorted(list_input())
	days = 0
	start = 0
	for i in arr:
		if i > days:
			days += 1
	print(days)
t = 1
for _ in range(t):
	solve()


import os
import sys
from queue import PriorityQueue

class InputReader:

	def __init__(self):
		self.IN = open('cf.in') if os.path.exists('cf.in') else sys.stdin
		self.tokens = []
		self.index = 0

	def check(self):
		if self.index >= len(self.tokens):
			self.tokens = self.IN.readline().rstrip('\n').split()
			self.index = 0

	def nextToken(self):
		self.check()
		self.index += 1
		return self.tokens[self.index - 1]
reader = InputReader()

def S():
	return reader.nextToken()

def I():
	return int(S())

def F():
	return float(S())
n = I()
pq = PriorityQueue()
for i in range(n):
	pq.put(I())
days = 0
while not pq.empty():
	if pq.get() >= days + 1:
		days += 1
print(days)


import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log10, log2, floor
from itertools import permutations
from heapq import heappush, heappop, heapify
inf = float('inf')
mod = 1000000007

def factorial_p(n, p):
	ans = 1
	if n <= p // 2:
		for i in range(1, n + 1):
			ans = ans * i % p
	else:
		for i in range(1, p - n):
			ans = ans * i % p
		ans = pow(ans, p - 2, p)
		if n % 2 == 0:
			ans = p - ans
	return ans

def nCr_p(n, r, p):
	ans = 1
	while n != 0 or r != 0:
		(a, b) = (n % p, r % p)
		if a < b:
			return 0
		ans = ans * factorial_p(a, p) * pow(factorial_p(b, p), p - 2, p) * pow(factorial_p(a - b, p), p - 2, p) % p
		n //= p
		r //= p
	return ans

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def is_prime(n):
	if n < 5 or n & 1 == 0 or n % 3 == 0:
		return 2 <= n <= 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			p = p * p % n
			if p == n - 1:
				break
		else:
			return False
	return True

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

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

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
Arr.sort()
visited = [False] * n
count = 0
i = 1
j = 0
while j < n:
	flag = 0
	for k in range(j, n):
		if Arr[k] >= i:
			count += 1
			i += 1
			j = k + 1
			flag = 1
			break
	if flag == 0:
		j = n
print(count)


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


input()
contests = sorted(list(map(int, input().split())))
days_norm = 1
train = 0
for i in contests:
	if i < days_norm:
		continue
	else:
		days_norm += 1
print(days_norm - 1)


import sys
import math
import collections
import bisect
import string

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

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

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	n = int(input())
	arr = get_list()
	ans = 0
	prob = 1
	arr.sort()
	for i in range(n):
		if arr[i] >= prob:
			prob += 1
			ans += 1
			continue
	print(ans)


def compute(arr):
	sarr = sorted(arr)
	k = 1
	for j in range(len(sarr)):
		if sarr[j] >= k:
			k = k + 1
	return k - 1

def main():
	n = int(input())
	arr = input().split(' ')
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	val = compute(arr)
	print(val)
main()


R = lambda : map(int, input().split())
input()
a = sorted(R())
c = 0
for i in a:
	if c < i:
		c += 1
print(c)


from bisect import bisect_left as bl
n = int(input())
l = list(map(int, input().strip().split()))
l1 = [-1] * n
l.sort()
ct = 1
for i in range(n):
	if l[i] >= ct:
		ct += 1
print(ct - 1)


range = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)
n = 1
for i in a:
	if n < i or n == i:
		n += 1
print(n - 1)


n = int(input())
arr = [int(x) for x in input().split()]
ans = 0
ind = 0
arr.sort()
for i in range(1, n + 1):
	if ind < n:
		if i <= arr[ind]:
			ans += 1
			ind += 1
		else:
			while ind + 1 < n:
				ind += 1
				if i <= arr[ind]:
					ans += 1
					ind += 1
					break
	else:
		break
print(ans)


n = input()
mass = list(map(int, input().split()))
days = 1
mass.sort()
for i in mass:
	if days <= i:
		days += 1
print(days - 1)


t = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
i = 0
while True:
	if i >= t:
		break
	if a[i] >= count + 1:
		count = count + 1
	i = i + 1
print(count)


n = int(input())
a = input()
b = a.split()
c = []
for i in b:
	c.append(int(i))
c.sort()
cn = 0
q = 1
for i in range(len(c)):
	if c[i] >= q:
		q += 1
		cn += 1
print(cn)


n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
reqd = 1
days = 0
for i in range(len(a)):
	if a[i] >= reqd:
		reqd += 1
		days += 1
print(days)


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


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


n = int(input())
li = list(map(int, input().split()))
l = sorted(li)
i = 0
c = 1
while i < len(l):
	if l[i] >= c:
		c += 1
	i += 1
print(c - 1)


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

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

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

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		l = list(In())
		l.sort()
		j = 1
		ans = 0
		for x in l:
			if j <= x:
				ans += 1
				j += 1
		print(ans)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


from sys import stdin

def ria(sep=''):
	if sep == '':
		return list(map(int, input().split()))
	else:
		return list(map(int, input().split(sep)))

def rsa(sep=''):
	if sep == '':
		return input().split()
	else:
		return input().split(sep)

def ri():
	return int(input())

def rd():
	return float(input())

def rs():
	return input()
N = ri()
A = ria()
A.sort()
idx = 0
toSolve = 1
while idx < N:
	if A[idx] >= toSolve:
		idx += 1
		toSolve += 1
	else:
		idx += 1
print(toSolve - 1)


n = int(input())
arr = sorted(list(map(int, input().split())))
k = 0
for i in arr:
	if k < i:
		k += 1
print(k)


n = int(input())
a = sorted(list(map(int, input().split())))
(ans, i) = (0, 0)
while i < n:
	if a[i] >= ans + 1:
		ans += 1
	i += 1
print(ans)


def solve(n, arr):
	result = 0
	arr.sort()
	for i in range(n):
		if arr[i] > result:
			result += 1
	return result
n = int(input())
arr = list(map(int, input().split()))
print(solve(n, arr))


n = int(input())
contests = list(map(int, input().split()))
contests.sort()
i = 0
for c in contests:
	if i + 1 <= c:
		i += 1
print(i)


n = int(input())
day = list(map(int, input().split()))
c = 0
d = 1
day.sort()
for i in range(len(day)):
	if day[i] >= d:
		c += 1
		d += 1
print(c)


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


while True:
	try:
		n = int(input())
		a = list(map(int, input().split()))
		a.sort()
		k = 1
		c = 0
		for i in a:
			if i < k:
				continue
			c += 1
			k += 1
		print(c)
	except:
		break


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L
c = cinn()
n = c.cin()
a = c.clist(n)
a.sort()
i = 1
tot = 0
cnow = 0
while True:
	if cnow == n:
		print(tot)
		break
	if i <= a[cnow]:
		tot += 1
		i += 1
		cnow += 1
	else:
		cnow += 1


(n, arr) = (int(input()), map(int, input().split()))
(cur, ans) = (1, 0)
for i in sorted(arr):
	if i < cur:
		continue
	ans += 1
	cur += 1
print(ans)


num = int(input())
data = [int(i) for i in input().split()]
data.sort()
ret = 0
for i in data:
	if i > ret:
		ret += 1
print(ret)


t = map(int, input())
l = [int(_) for _ in input().split()]
l.sort()
c = 0
for i in l:
	if i > c:
		c += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
x = 1
for i in range(n):
	if a[i] >= x:
		c += 1
		x += 1
	else:
		continue
print(c)


n = int(input())
probs = list(map(int, input().split()))
probs.sort()
days = 0
for prob in probs:
	if prob >= days + 1:
		days += 1
print(days)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
count = 0
day = 1
for q in range(1, len(arr) + 1):
	if arr[q - 1] >= day:
		count += 1
		day += 1
print(count)


n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
i = 0
count = 0
while i < len(a):
	if a[i] >= count + 1:
		count += 1
	i += 1
print(count)


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 1
i = 0
while i < n:
	if a[i] >= c:
		c += 1
	i += 1
print(c - 1)


n = int(input())
l = list(map(int, input().split()))
l.sort()
(d, e) = (0, 1)
for i in range(n):
	if l[i] >= e:
		e += 1
		d += 1
print(d)


def get_days(problems):
	problems.sort()
	prob_count = 1
	for item in problems:
		if prob_count <= item:
			prob_count += 1
	return prob_count - 1
num = int(input())
contests = [int(item) for item in input().split()]
print(get_days(contests))


n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in l:
	if i > ans:
		ans += 1
print(ans)


n = int(input())
conts = [int(i) for i in input().split()]
conts.sort()
ans = 0
day = 1
i = 0
while i < n:
	if conts[i] >= day:
		ans += 1
		day += 1
	i += 1
print(ans)


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
a = list(map(int, input().split()))
a.sort()
ct = 1
for i in a:
	if i >= ct:
		ct += 1
print(ct - 1)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
total = 0
last = 0
cur = 0
while cur < n:
	x = a[cur]
	if x > last:
		total += 1
		last += 1
	cur += 1
print(total)


def findNextMax(li, n, i, k):
	for j in range(i, n):
		if li[j] >= k:
			return j
	return -1
n = int(input())
li = list(map(int, input().split()))
li.sort()
k = 1
i = 0
while i < n:
	if k > li[i]:
		j = findNextMax(li, n, i + 1, k)
		if j == -1:
			break
		i = j
	k += 1
	i += 1
print(k - 1)


n = int(input())
contests = list(map(int, input().split()))
contests = sorted(contests)
days = 0
k = 1
i = 0
while True:
	while i < n and contests[i] < k:
		i += 1
	if i < n and contests[i] >= k:
		i += 1
		k += 1
		days += 1
	else:
		break
print(days)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
i = 0
j = 0
answ = 0
while j < n:
	if a[j] >= i + 1:
		i += 1
		j += 1
		answ += 1
	else:
		j += 1
print(answ)


int(input())
a = [i for i in input().split()]
a = list(map(int, a))
a.sort()
d = 0
d1 = 1
for i in range(len(a)):
	if a[i] >= d1:
		d = d + 1
		d1 = d1 + 1
print(d)


n = int(input())
a = map(int, input().split())
sa = sorted(a)
ptr = 0
for i in range(1, n + 2):
	while ptr < n and sa[ptr] < i:
		ptr += 1
	if ptr == n:
		print(i - 1)
		break
	ptr += 1


n = int(input())
numProContest = sorted(list(map(int, input().split(' '))))
count = 1
for i in numProContest:
	if i >= count:
		count += 1
print(count - 1)


import sys
f = sys.stdin
ncontests = int(f.readline().strip())
problems_per_contest = [int(ppc_s) for ppc_s in f.readline().strip().split()]
problems_per_contest.sort()
days = 0
problems_to_solve = 1
for problems_available in problems_per_contest:
	if problems_available >= problems_to_solve:
		days = days + 1
		problems_to_solve = problems_to_solve + 1
print(days)


n = int(input())
ar = list(map(int, input().split()))
ar.sort()
cnt = 0
t = 1
for i in ar:
	if i >= t:
		cnt += 1
		t += 1
print(cnt)


n = int(input())
a = sorted(list(map(int, input().split())))
(q1, q2) = (1, 0)
while len(a) > q2:
	while len(a) > q2 and a[q2] < q1:
		q2 += 1
	if len(a) > q2:
		(q1, q2) = (q1 + 1, q2 + 1)
print(q1 - 1)


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd

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

def si():
	return str(input())

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

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

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

def fsi():
	return str(stdin.readline())

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

def fli():
	return list(fmi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s
n = ii()
l = sorted(li())
k = 0
for i in range(n):
	if l[i] > k:
		k += 1
print(k)


n = int(input())
v = list(map(int, input().split()))
v.sort()
l = len(v)
dia = 1
for i in range(l):
	if v[i] >= dia:
		dia += 1
print(dia - 1)


from sys import stdin
input = stdin.readline
n = int(input())
a = sorted([int(i) for i in input().split()])
res = 0
k = 1
for i in range(n):
	if a[i] >= k:
		res += 1
		k += 1
print(res)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
k = 1
for i in a:
	if i >= k:
		k += 1
print(k - 1)


n = int(input())
a = [int(k) for k in input().split()]
a.sort()
c = 1
cnt = 0
for k in a:
	if k - c > -1:
		c += 1
		cnt += 1
print(cnt)


n = int(input())
a = list(map(int, input().strip().split(' ')))
a.sort()
pp = 1
for i in range(n):
	if a[i] >= pp:
		pp += 1
print(pp - 1)


n = int(input())
a = list(map(int, input().split()))
res = 0
j = 1
a.sort()
for k in a:
	if k >= j:
		res += 1
		j += 1
print(res)


n = int(input())
a = sorted(list(map(int, input().split())))
days = 1
for i in a:
	if days <= i:
		days += 1
print(days - 1)


x = int(input())
n = list(map(int, input().split(' ')))
n = sorted(n)
start = 1
for x in n:
	if x < start:
		continue
	else:
		start += 1
print(start - 1)


n = int(input())
l = list(map(int, input().split()))
no_p = 1
l.sort()
for i in l:
	if i >= no_p:
		no_p += 1
print(no_p - 1)


n = int(input())
k = [*map(int, input().split())]
k.sort()
cnt = 0
for i in k:
	if i > cnt:
		cnt += 1
print(cnt)


num = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
count = 0
day = 1
for i in range(num):
	if arr[i] >= day:
		count += 1
		day += 1
print(count)


def main():
	x = input()
	contests = list(map(int, input().split()))
	contests.sort()
	count = 0
	for i in range(len(contests)):
		if count + 1 <= contests[i]:
			count += 1
	print(count)
main()


fecha = int(input())
day = 1
days = input().split(' ')
for i in range(len(days)):
	days[i] = int(days[i])
days = sorted(days)
index = 0
while len(days) > index:
	if days[index] < day:
		index += 1
	else:
		day += 1
		index -= -1
print(day - 1)


import math
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
i = 0
day = 1
while True:
	if i == n:
		break
	if a[i] >= day:
		day += 1
		i += 1
	else:
		i += 1
print(day - 1)


inputVa = input()
z = input()
a = z.split(' ')
a = list(map(int, a))
a.sort()
counter = 0
for i in range(len(a)):
	if a[i] >= counter + 1:
		counter = counter + 1
print(counter)


n = int(input())
lst = list(map(int, input().strip().split(' ')))
i = 0
j = 1
c = 0
lst.sort()
while i < n:
	if lst[i] >= j:
		c += 1
		i += 1
		j += 1
	else:
		i += 1
print(c)


C = int(input())
P = list(map(int, input().strip().split()))
P.sort()
days = 1
for j in range(0, C):
	if P[j] >= days:
		days = days + 1
print(days - 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
day = 1
ans = 0
for i in a:
	if i >= day:
		ans += 1
		day += 1
print(ans)


N = int(input())
Arr = [int(_) for _ in input().split()]
Arr.sort()
k = 1
i = 0
count = 0
while i < N:
	if Arr[i] >= k:
		count += 1
		k += 1
	i += 1
print(count)


import sys
days = 0
k = 1
length = int(sys.stdin.readline())
problems = sys.stdin.readline().strip().split(' ')
problems = list(map(lambda x: int(x), problems))
problems = sorted(problems)
for x in problems:
	if k <= x:
		days += 1
		k += 1
print(days)


n = int(input())
data = [int(i) for i in input().split()]
data.sort()
ans = 0
k = 1
for i in range(n):
	if data[i] >= k:
		k += 1
	else:
		continue
print(k - 1)


n = int(input())
a = list(map(int, input().split()))
count = 0
a.sort()
num = 1
for i in range(len(a)):
	if a[i] >= num:
		count += 1
		num += 1
print(count)


a = int(input())
b = input()
l = []
l = list(b.split())
for i in range(len(l)):
	l[i] = int(l[i])
l.sort()
ans = 0
curr = 1
for i in range(len(l)):
	if int(l[i]) > ans:
		ans += 1
print(ans)


n = int(input())
z = sorted(list(map(int, input().split())))
k = 1
for i in range(n):
	if z[i] >= k:
		k += 1
print(k - 1)


def polycarpTraining(A):
	A.sort()
	i = 0
	days = 0
	Probs = 1
	while True:
		if i == len(A):
			print(days)
			break
		elif Probs <= A[i]:
			A[i] = -1
			days += 1
			Probs += 1
		else:
			i += 1
t = int(input())
A = list(map(int, input().split()))
polycarpTraining(A)


t = int(input())
k = list(map(int, input().split()))
k.sort()
c = 0
n = 1
for i in range(len(k)):
	if n <= k[i]:
		c += 1
		n += 1
print(c)


import sys
import collections
import math
import heapq
from operator import itemgetter

def getint():
	return int(input())

def getints():
	return [int(x) for x in input().split(' ')]
n = getint()
a = getints()
result = 0
a.sort()
i = 1
while i <= n:
	while i <= n and a[i - 1] < result:
		i += 1
	if i > n:
		break
	if a[i - 1] > result:
		result += 1
	i += 1
print(str(result))


input()
l = sorted([int(i) for i in input().split()])
ans = 0
c = 1
x = l[::-1]
while not len(x) is 0:
	if x[-1] >= c:
		x.pop()
		c += 1
	else:
		x.pop()
print(c - 1)


n = int(input())
a = list(map(int, input().split()))
k = 1
a.sort()
i = 0
while i < n:
	if a[i] >= k:
		k += 1
		i += 1
	else:
		i += 1
k -= 1
if k > n:
	print(n)
else:
	print(k)


import math
import bisect
import heapq
from collections import defaultdict

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, x, y) = egcd(b % a, a)
		return (g, y - b // a * x, x)

def mulinv(b, n):
	(g, x, _) = egcd(b, n)
	if g == 1:
		return x % n

def isprime(n):
	for d in range(2, int(math.sqrt(n)) + 1):
		if n % d == 0:
			return False
	return True

def argsort(ls):
	return sorted(range(len(ls)), key=ls.__getitem__)

def f(p=0):
	if p == 1:
		return map(int, input().split())
	elif p == 2:
		return list(map(int, input().split()))
	elif p == 3:
		return list(input())
	else:
		return int(input())
n = f()
cl = sorted(f(2))
count = cl[-1]
res = n
for i in range(n - 2, -1, -1):
	count = min(cl[i], count - 1)
	if count == 0:
		res = n - i - 1
		break
print(res)


N = int(input())
V = list(map(int, input().split()))
V.sort()
need = 1
best = 0
for i in range(N):
	if V[i] >= need:
		best += 1
		need += 1
print(best)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
k = 0
now = 1
for i in range(n):
	if a[i] >= now:
		k += 1
		now += 1
print(k)


a = int(input())
b = list(map(int, input().split()))
b.sort()
dias = 1
for i in range(a):
	if b[i] >= dias:
		dias += 1
print(dias - 1)


n = int(input())
a = [int(n) for n in input().strip().split()]
a.sort()
days = 0
queue_head = 0
queue_tail = n
for k in range(1, n + 1):
	while queue_head < queue_tail and k > int(a[queue_head]):
		queue_head += 1
	if queue_head < queue_tail and k <= int(a[queue_head]):
		days += 1
		queue_head += 1
print('{}'.format(days))


n = int(input())
A = [int(i) for i in input().split()]
A.sort()
ans = 0
past = 0
for i in range(n):
	reqd = past + 1
	if A[i] >= reqd:
		ans += 1
		past += 1
print(ans)


contests = int(input())
questoes = input().split()
for i in range(len(questoes)):
	questoes[i] = int(questoes[i])
cont = 1
dias = 0
questoes.sort()
for e in questoes:
	if e >= cont:
		cont += 1
		dias += 1
print(dias)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
flag = 0
index = 0
count = 1
ans = 0
while flag == 0:
	if arr[index] >= count:
		index += 1
		count += 1
		ans += 1
	else:
		index += 1
	if index == n:
		flag = 1
		break
print(ans)


c = int(input())
p = list(map(int, input().split()))
p.sort()
d = 0
q = 1
for i in range(c):
	if q <= int(p[i]):
		d += 1
		q += 1
print(d)


t = int(input())
a = list(map(int, input().rstrip().split()))
g = [i for i in range(1, t + 1)]
l = []
l = l + a
l.sort()
count = 0
var = 1
for i in l:
	if i >= var:
		var += 1
		count += 1
print(count)


n = int(input())
m = list(map(int, input().split()))
m.sort()
index = 0
count = 0
while index < n:
	if m[index] >= count + 1:
		index += 1
		count += 1
		continue
	else:
		while index < n and m[index] < count + 1:
			index += 1
print(count)


n = int(input())
l = sorted(list(map(int, input().split())))
s = 1
for i in range(n):
	if l[i] >= s:
		s += 1
print(s - 1)


n = int(input().strip())
arr = list(map(int, input().strip().split()))
arr.sort()
k = 1
for i in arr:
	if i >= k:
		k += 1
print(k - 1)


n = int(input())
vals = list(map(int, input().split()))
vals.sort()
time = 1
for i in vals:
	if time <= i:
		time += 1
print(time - 1)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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))
mod = 1000000007

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 zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	a = lis()
	a = sorted(a)
	i = 0
	day = 1
	while i < n:
		if a[i] < day:
			i += 1
			continue
		else:
			a[i] -= day
			i += 1
			day += 1
			continue
	print(day - 1)
testcase(1)


n = int(input())
s = input().split()
for i in range(len(s)):
	s[i] = int(s[i])
s.sort()
k = 0
i = 0
while i < n:
	if s[i] >= k + 1:
		k = k + 1
	i = i + 1
print(k)


import bisect
n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
l = []
j = 0
days = 0
while True:
	if j == n:
		break
	if arr[j] >= days + 1:
		days += 1
	j += 1
print(days)


nb = int(input())
probleme = list(map(int, input().split()))
probleme.sort()
i = 0
k = 1
u = 0
while True:
	if probleme[i] >= k:
		u += 1
		k += 1
		i += 1
	else:
		i += 1
	if i == nb:
		break
print(u)


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


def main():
	n = int(input())
	arr = sorted(map(int, input().split()))
	j = 1
	for x in arr:
		if x >= j:
			j += 1
	print(j - 1)
	return 0
main()


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
days = 0
for i in l:
	if i > days:
		days += 1
print(days)


ent = int(input())
val = input().split()
dados = []
cont = 0
for num in val:
	dados.append(int(num))
dados.sort()
treta = range(1, ent + 1)
for i in range(ent):
	if dados[i] >= treta[cont]:
		cont += 1
print(cont)


n = int(input())
s = [int(i) for i in input().split()]
s.sort()
counter = 0
for i in range(n):
	if s[i] >= counter + 1:
		counter += 1
print(counter)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math

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

def stringListIn():
	return [x for x in stdin.readline().split()]

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

def stringIn():
	return stdin.readline().strip()
n = intIn()
a = listIn()
b = sorted(a)
ans = 0
i = 1
j = 0
while j < n:
	if b[j] >= i:
		ans += 1
		i += 1
		j += 1
	else:
		j += 1
print(ans)


import sys
import math
import collections
from pprint import pprint as pp
mod = 1000000007
MAX = 10 ** 10

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat
(n, a) = (int(input()), list(map(int, input().split())))
a.sort()
k = 1
for i in range(n):
	if a[i] >= k:
		k += 1
print(k - 1)


def f(n, t):
	t.sort()
	i = 0
	count = 0
	for x in range(n):
		while t[i] <= x:
			i += 1
			if i >= n:
				break
		if i >= n:
			break
		count += 1
		i += 1
		if i >= n:
			break
	print(count)
a = int(input())
b = input().split()
t = []
for item in b:
	t.append(int(item))
f(a, t)


n = int(input())
l = sorted(list(map(int, input().split())))
ans = 1
for i in l:
	if i >= ans:
		ans += 1
print(ans - 1)


n = int(input())
l = list((int(c) for c in input().split()))
l = sorted(l)
pos = 1
for i in l:
	if i >= pos:
		pos += 1
print(pos - 1)


import math
s = int(input())
k = 0
a = list(map(int, input().split()))
a.sort()
k = 0
m = 0
i1 = 0
for i in range(0, s):
	if a[k] >= i + 1 - i1:
		k = k + 1
		m = m + 1
	else:
		i1 = i1 + 1
		k = k + 1
print(m)


cont = int(input())
L = input().split()
L = [int(x) for x in L]
L.sort()
days = 0
kday = 1
for i in range(len(L)):
	if L[i] >= kday:
		days += 1
		kday += 1
print(days)


from sys import stdin

def input():
	return stdin.readline()[:-1]
n = int(input())
a = list(map(int, input().split()))
plot = [0] * (n + 2)
for i in range(n):
	if a[i] <= n:
		plot[a[i]] += 1
	else:
		plot[n + 1] += 1
remaining = 0
last = 0
for i in range(1, n + 2):
	remaining = max(remaining - plot[i] + 1, 0)
	last = max(i - remaining, last)
print(last)


n = int(input())
sp = list(map(int, input().split()))
sp.sort()
k = 1
ind = 0
while ind != n:
	if sp[ind] >= k:
		k += 1
	ind += 1
print(k - 1)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
l = sorted(L())
c = 0
d = 1
for i in range(len(l)):
	if l[i] >= d:
		c += 1
		d += 1
print(c)


def days(list):
	list.sort()
	(count, i) = (0, 0)
	(counter, z) = (1, True)
	while i < len(list) and z:
		if list[i] >= counter:
			count += 1
			counter += 1
			i += 1
		else:
			i += 1
	return count
n = int(input())
l = list(map(int, input().strip().split()))
print(days(l))


n = int(input())
s = input().split()
res = 0
for i in range(n):
	s[i] = int(s[i])
s = sorted(s)
k = 1
for i in range(n):
	if s[i] >= k:
		res += 1
		k += 1
print(res)


import collections
n = input()
n = int(n)
lis = list(map(int, input().split()))
newdic = {}
for i in lis:
	try:
		newdic[i] += 1
	except KeyError:
		newdic.update({i: 1})
newdic1 = collections.OrderedDict(sorted(newdic.items()))
count = 1
for i in newdic1:
	while i >= count and newdic1[i] != 0:
		newdic1[i] -= 1
		count += 1
print(count - 1)


n = int(input())
s = [int(i) for i in input().split()]
s.sort()
res = 0
k = 1
for i in s:
	if i >= k:
		res += 1
		k += 1
print(res)


n = input()
c = list(map(int, input().split()))
c.sort()
d = 0
for (i, v) in enumerate(c):
	if v >= d + 1:
		d += 1
print(d)


import collections

def fun(n, num):
	s = list(num)
	s.sort()
	dic = collections.defaultdict(int)
	for number in s:
		dic[number] += 1
	ans = 1
	for i in dic:
		while ans <= i and dic[i] > 0:
			if ans < i:
				dic[i] -= 1
			else:
				dic[i] = 0
			ans += 1
	return ans - 1
n = map(int, input().split())
num = map(int, input().split())
print(fun(n, num))


n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 0
j = 0
for i in range(1, n + 1):
	while j < n and i > a[j]:
		j += 1
	if j < n and i <= a[j]:
		d += 1
		j += 1
print(d)


n = int(input())
A = [0] * n
IN = input().split()
for i in range(0, n):
	A[i] = int(IN[i])
A.sort()
idx = 0
ans = 1
while idx < n:
	if A[idx] >= ans:
		ans += 1
	idx += 1
print(ans - 1)


n = int(input())
mas = [int(i) for i in input().split()]
mas = sorted(mas)
k = 1
for i in range(n):
	if mas[i] >= k:
		k += 1
print(k - 1)


n = int(input())
b = input().split()
f = 0
a = []
for i in range(n):
	a.append(int(b[i]))
a.sort()
need = 1
day = 0
for i in range(len(a)):
	if a[i] >= need:
		need += 1
		day += 1
print(day)


n = int(input())
if n > 0:
	contests = [int(i) for i in input().split(' ')]
	contests.sort()
	c = 0
	for i in contests:
		if i > c:
			c += 1
	print(c)
else:
	print(0)


from array import array
n = int(input())
kontests = array('L', sorted(list(map(int, input().split()))))
days = 1
for i in kontests:
	if days > i:
		continue
	days += 1
print(days - 1)


num = int(input())
arr = sorted(map(int, input().split()), reverse=True)
ans = 0
k = 1
while arr:
	x = arr.pop()
	if x >= k:
		ans += 1
		k += 1
print(ans)


n = int(input())
pre = [int(i) for i in input().split()]
ans = 0
pre.sort()
for i in pre:
	if i > ans:
		ans += 1
print(ans)


N = int(input())
lineup = sorted([int(x) for x in input().split()])
counter = 1
checker = [0] * N
for i in range(len(lineup)):
	if lineup[i] >= counter:
		lineup[i] = 0
		counter += 1
	else:
		lineup[i] = 0
print(counter - 1)


n = int(input())
l = list(input().split(' '))
for i in range(len(l)):
	l[i] = int(l[i])
l = sorted(l)
j = 1
c = 0
for i in l:
	if i >= j:
		c = c + 1
		j = j + 1
print(c)


a = int(input())
b = [int(x) for x in input().split()]
b.sort()
s = 1
q = 0
for i in b:
	if i >= s:
		s += 1
		q += 1
print(q)


n = int(input())
a = []
inp = input().split()
for i in inp:
	a.append(int(i))
cur_day = 1
a.sort()
for i in range(n):
	if a[i] >= cur_day:
		cur_day += 1
print(cur_day - 1)


n = int(input())
l = sorted(list(map(int, input().split())))
d = 0
ans = 1
for i in range(n):
	if l[i] >= ans:
		d += 1
		ans += 1
	else:
		continue
print(d)


number_of_contests = int(input())
number_of_problems = [int(x) for x in input().split()]
days = 0
train_for_each_day = 1
number_of_problems.sort()
for p in number_of_problems:
	if p >= train_for_each_day:
		days += 1
		train_for_each_day += 1
print(days)


n = int(input())
a = list(map(int, input().split()))
b = set(a)
result = 0
d = {}
if len(b) == len(a):
	print(len(a))
else:
	a.sort()
	for i in a:
		if i not in d:
			d[i] = 1
		elif i in d:
			d[i] += 1
	for i in d:
		if result + d[i] <= i:
			result += d[i]
		else:
			result += i - result
	print(result)


from sys import stdin

def main():
	N = int(input())
	A = list(map(int, input().split()))
	A.sort()
	(ans, day) = (0, 1)
	for n in A:
		if n >= day:
			ans += 1
			day += 1
	print(ans)
input = lambda : stdin.readline()
main()


n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 1
ans = 0
i = 0
while i < n:
	if a[i] >= d:
		d += 1
		ans += 1
	i += 1
print(ans)


t = int(input())
list1 = list(map(int, input().split()))
list1.sort()
count = 1
for i in range(0, t):
	if list1[i] >= count:
		count += 1
print(count - 1)


n = int(input())
ar = [int(x) for x in input().split(' ')]
ar.sort()
cnt = 0
k = 1
for i in range(n):
	if ar[i] >= k:
		cnt += 1
		k += 1
print(cnt)


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

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

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = 1
	for _ in range(t):
		n = int(input())
		arr = inar()
		arr.sort()
		ans = 0
		check = 1
		for i in range(n):
			if check <= arr[i]:
				ans += 1
				check += 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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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


_ = input()
arr = [int(n) for n in input().strip().split()]
arr.sort()
pos = 1
for val in arr:
	if val >= pos:
		pos += 1
print(pos - 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 0
k = 1
for ea in a:
	if ea < k:
		continue
	else:
		d += 1
		k += 1
print(d)


n = int(input())
a = [int(x) for x in input().split(' ')]
a.sort()
ans = 0
i = 1
j = 0
while j < n:
	if a[j] >= i:
		i += 1
	j += 1
print(i - 1)


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


n = int(input())
a = list(map(int, input().rstrip().split()))
b = sorted(a)
last = 1
for i in range(n):
	if last <= b[i]:
		last = last + 1
print(last - 1)


n = int(input())
a = sorted(map(int, input().split()))
c = 1
i = 0
while True:
	while i < n and a[i] < c:
		i += 1
	if i == n:
		break
	i += 1
	c += 1
print(c - 1)


n = int(input())
ar = list(map(int, input().split()))
ar = sorted(ar)
count = 0
for i in ar:
	if i > count:
		count += 1
print(count)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	n = I()
	a = sorted(LI())
	r = 0
	for c in a:
		if c > r:
			r += 1
	return r
print(main())


t = int(input())
a = list(map(int, input().split()))
a.sort()
c = 1
val = 0
for x in a:
	if x >= c:
		val += 1
		c += 1
print(val)


n = int(input())
s = sorted([int(i) for i in input().split()])
need = 1
for i in s:
	if i >= need:
		need += 1
print(need - 1)


c = 0
k = 0
n = int(input(''))
a = list(map(int, input('').split()))
b = sorted(a)
for i in range(len(a)):
	if b[i] >= k + 1:
		c += 1
		k += 1
	else:
		pass
print(c)


import os
import sys

def log(*args, **kwargs):
	if os.environ.get('CODEFR'):
		print(*args, **kwargs)
n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 0
for (i, ai) in enumerate(a):
	if ai >= d + 1:
		d += 1
print(d)


d = int(input())
c = list(map(int, input().split()))
c.sort()
ans = 0
s = 0
for i in range(1, d + 1):
	if i > c[d - 1]:
		break
	for j in range(s, d):
		if c[j] >= i:
			s = j + 1
			c[j] = 0
			ans += 1
			break
print(ans)


n = int(input())
d = sorted(list(map(int, input().split())))
s = 1
c = 0
for i in d:
	if i >= s:
		c += 1
		s += 1
print(c)


n = int(input())
a = list(map(int, input().split()))
k = 1
a = sorted(a)
for c in a:
	if c >= k:
		k += 1
print(k - 1)


from collections import deque
n = int(input())
a = sorted(list(map(int, input().split())))[::-1]
a = deque(a)
ans = 1
while len(a) > 0:
	if a[-1] > ans:
		ans += 1
		a.pop()
	else:
		while len(a) > 0 and a[-1] <= ans:
			a.pop()
print(min(ans, n))


import heapq
N = int(input())
a_list = list(map(int, input().split()))
heapq.heapify(a_list)
ans = 0
day = 1
while len(a_list) != 0:
	a = heapq.heappop(a_list)
	if a >= day:
		ans += 1
		day += 1
print(ans)


n = int(input())
lista = list(map(int, input().split()))
lista.sort()
num = 1
ans = 0
for e in lista:
	if num <= e:
		num += 1
		ans += 1
print(ans)


n = int(input())
arr = map(int, input().split())
arr = list(arr)
arr.sort()
k = 0
for i in range(len(arr)):
	if arr[i] < i - k + 1:
		arr[i] = 0
		k += 1
z = 0
for i in range(n):
	if arr[i] != 0:
		z += 1
print(z)


n = int(input())
a = sorted(map(int, input().split()))[::-1]
x = 0
while a:
	while a and a[-1] <= x:
		a.pop()
	if a:
		x += 1
		a.pop()
print(x)


n = int(input())
lst = sorted(list(map(int, input().split())))
isum = 0
day = 1
for i in range(n):
	if lst[i] >= day:
		isum += 1
		day += 1
print(isum)


import sys
import os
input = sys.stdin.buffer.readline
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
k = 1
ans = 0
for i in range(n):
	if arr[i] >= k:
		ans += 1
		k += 1
	else:
		continue
print(ans)


R = lambda : map(int, input().split())
n = int(input())
a = sorted(R())
ans = 0
for i in a:
	ans += i > ans
print(ans)


x = input()
st = input()
li = st.split()
data = [int(d) for d in li]
data.sort()
i = 1
j = 0
for num in data:
	if num >= i:
		i = i + 1
		j = j + 1
		continue
	else:
		continue
print(j)


n = int(input())
a = list(map(int, input().split()))
a.sort()
c = []
j = 1
for i in range(n):
	if a[i] >= j:
		c.append(a[i])
		j = j + 1
print(len(c))


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
t = 0
for num in a:
	if num > t:
		t += 1
print(t)


n = int(input())
vals = input().split(' ')
vals = [int(a) for a in vals]
vals.sort()
current = 1
for x in vals:
	if x >= current:
		current += 1
print(current - 1)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

def li():
	return list(map(int, input().split()))

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

def nu():
	return int(input())

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

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007
yp = 0

def solve():
	t = 1
	for _ in range(t):
		n = nu()
		a = li()
		a.sort()
		cc = 0
		day = 1
		for i in range(n):
			if a[i] < day:
				continue
			cc += 1
			day += 1
		print(cc)
solve()


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	i = 0
	day = 0
	while i < n:
		if a[i] >= day + 1:
			day = day + 1
		i = i + 1
	print(day)
main()


n = int(input().split()[0])
contest = [int(x) for x in input().split()]
contest.sort()
days = 0
for i in range(len(contest)):
	if contest[i] >= days + 1:
		days = days + 1
print(days)


n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)
k = 1
res = 0
for i in range(n):
	if a[i] >= k:
		k += 1
		res += 1
print(res)


n = int(input())
a = input().split(' ')
for i in range(n):
	a[i] = int(a[i])
sor = sorted(a)
ans = 0
curr = 1
for i in range(n):
	if curr <= sor[i]:
		ans = ans + 1
		curr = curr + 1
print(ans)


a = int(input())
b = [int(b) for b in input().split()]
b.sort()
k = 1
s = 0
while k <= b[a - 1]:
	while s < a:
		if k <= b[s]:
			b[s] = 0
			s = s + 1
			break
		else:
			s = s + 1
	k = k + 1
print(k - 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
idx = 0
max_day = 1
while idx < n:
	idx += 1
	if idx < n:
		if a[idx] >= max_day + 1:
			max_day += 1
print(max_day)


from sys import stdin, stdout
n = int(stdin.readline())
l = [int(i) for i in stdin.readline().split()]
l.sort()
cur = 0
c = 0
for i in range(1, n + 1):
	while cur < n and l[cur] < i:
		cur += 1
	if cur < n and l[cur] >= i:
		c += 1
	cur += 1
print(c)


from bisect import bisect_left

def find_ge(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		del a[i]
		return i
	else:
		return -1
n = int(input())
a = list(map(int, input().split()))
a.sort()
cnt = 0
day = 1
for elem in a:
	if elem < day:
		continue
	cnt += 1
	day += 1
print(cnt)


n = int(input())
l = sorted(list(map(int, input().split())))
i = 0
k = 1
count = 0
for i in l:
	if i >= k:
		count += 1
		k += 1
print(count)


n = int(input())
l = list(map(int, input().split()))
l.sort()
c = 1
d = 0
for k in l:
	if k >= c:
		c += 1
print(c - 1)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
b = 1
for x in range(n):
	if a[x] >= b:
		b += 1
print(b - 1)


from collections import defaultdict
import math
x = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
curr = 1
pos = 0
while pos < x:
	if a[pos] >= curr:
		ans += 1
		curr += 1
	pos += 1
print(ans)


n = int(input())
a = map(int, input().split())
a = sorted(a)
count = 0
index = 1
for i in range(len(a)):
	if a[i] >= index:
		count += 1
		index += 1
print(count)


n = int(input())
entrada = input().split()
numeros = []
for k in entrada:
	numeros.append(int(k))
numeros.sort()
dias = 0
count = 1
for d in numeros:
	if d >= count:
		dias = dias + 1
		count = count + 1
print(dias)


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
ans = 0
cnt = 1
pos = 0
while 1:
	if cnt <= arr[pos]:
		ans += 1
		cnt += 1
		pos += 1
	else:
		pos += 1
	if pos == n:
		break
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = 0
k = 1
l = len(a)
for i in range(l):
	if a[i] >= k:
		ans += 1
		k += 1
print(ans)


def solve(A, n):
	A.sort()
	pos = 1
	for i in range(n):
		if A[i] >= pos:
			pos += 1
	return pos - 1
n = int(input())
A = [int(n) for n in input().split()]
print(solve(A, n))


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = 0
i = 0
k = 1
while i < n:
	if a[i] >= k:
		k += 1
		ans += 1
	i += 1
print(ans)


import math
from collections import defaultdict, Counter, deque

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	n = int(input())
	arr = sorted(list(map(int, input().split())))
	extra = 0
	k = 1
	days = 0
	for i in arr:
		if i >= k:
			days += 1
			k += 1
	print(days)
t = 1
for _ in range(t):
	main()


n = int(input())
a = sorted(list(map(int, input().split())))
p = []
p.append(1)
for i in range(1, len(a)):
	if a[i] > len(p):
		p.append(a[i])
print(len(p))


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


def go():
	n = int(input())
	a = sorted([int(i) for i in input().split(' ')])
	j = 0
	total = 0
	for i in range(1, n + 1):
		while j < n and a[j] < i:
			j += 1
		if j == n:
			break
		total += 1
		j += 1
	return total
print(go())


input()
c = sorted(map(int, input().split()))
days = 0
for i in range(len(c)):
	if c[i] > days:
		days += 1
print(days)


n = int(input())
a = list(map(int, input().split()))
a.sort()
day = 1
for x in a:
	if x >= day:
		day += 1
print(day - 1)


n = int(input())
z = input()
z = list(z.split(' '))
l = 0
j = 1
s = [int(x) for x in z]
s = sorted(s)
for i in range(0, len(s)):
	if s[i] >= j:
		l = l + 1
		j = j + 1
print(l)


n = int(input())
a = [int(s) for s in input().split()]
a = sorted(a)
k = 1
i = 0
while i < n:
	if a[i] >= k:
		k += 1
	i += 1
print(k - 1)


n = int(input())
lnum = list()
iii = input()
iii = iii.split(' ')
lnum = list()
for num1 in iii:
	lnum.append(int(num1))
lnum.sort()
k = 1
for curr in lnum:
	if k <= curr:
		k += 1
print(k - 1)


def training(n, a):
	a = sorted(a)
	result = 1
	idx = 0
	while True:
		if idx >= n:
			break
		if a[idx] >= result:
			result += 1
		idx += 1
	return result - 1
n = int(input())
a = [int(item) for item in input().split()]
print(training(n, a))


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


n = int(input())
mat = list(map(int, input().split()))
mat = sorted(mat)
day = 1
for i in mat:
	if i >= day:
		day += 1
print(day - 1)


n = int(input())
contests = list(map(int, input().split()))
contests.sort()
days = [i + 1 for i in range(n)]
(i, j, out) = (0, 0, 0)
while i < n and j < n:
	if days[i] <= contests[j]:
		i += 1
		j += 1
		out += 1
	else:
		j += 1
print(out)


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


n = int(input())
array = [int(s) for s in input().split()]
array = sorted(array)
curr = 1
counter = 0
for i in range(len(array)):
	if array[i] >= curr:
		counter += 1
		curr += 1
print(counter)


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


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


n = int(input())
t = list(map(int, input().split()))
t.sort()
p = 1
for k in range(n):
	if t[k] >= p:
		t[k] = 0
		p += 1
	else:
		pass
print(p - 1)


k = int(input())
a = list(map(int, input().split()))
a = sorted(a)
s = 0
for i in a:
	if i > s:
		s += 1
print(s)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ct = 0
p = 0
for x in range(n):
	day = x + 1
	while p < n:
		q = arr[p]
		i = p
		if q >= day:
			ct = ct + 1
			p = i + 1
			break
		p += 1
print(ct)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
cnt = 0
c = 1
for i in arr:
	if i >= c:
		cnt += 1
		c += 1
print(cnt)


n = int(input())
l = list(map(int, input().split()))
l.sort()
p = 0
c = 1
for i in range(n):
	if l[i] >= c:
		c += 1
		p += 1
print(p)


n = int(input())
(*l,) = map(int, input().split())
l.sort()
ans = 0
for i in range(len(l)):
	if l[i] > ans:
		ans += 1
	else:
		continue
print(ans)


n = int(input())
A = list(map(int, input().split()))
A.sort()
k = 1
for i in A:
	if i >= k:
		k += 1
print(k - 1)


n = int(input())
a = list(map(int, input().split()))
contest = a.copy()
contest.sort()
day = 1
i = 0
while i < n:
	if contest[i] >= day:
		day += 1
	i += 1
print(day - 1)


n = int(input())
c = [int(x) for x in input().split()]
c = sorted(c)
cnt = 0
k = 1
for e in c:
	if e >= k:
		cnt += 1
		k += 1
	else:
		continue
print(cnt)


n = int(input())
a = [int(j) for j in input().split()]
a.sort()
ind = 0
solve = 1
day = 0
while ind != n:
	if a[ind] >= solve:
		day += 1
		solve += 1
	ind += 1
print(day)


n = int(input())
seq = sorted((int(x) for x in input().split()))
ans = 0
for i in range(n):
	if seq[i] > ans:
		ans += 1
print(ans)


n = int(input())
tab = list(map(int, input().split()))
tab.sort()
nb = 1
for item in tab:
	if item >= nb:
		nb += 1
print(nb - 1)


n = int(input())
a = map(int, input().strip().split(' '))
a_sorted = iter(sorted(a))
(idx, res) = (0, 0)
while True:
	try:
		elem = next(a_sorted)
	except:
		break
	if idx + 1 <= elem:
		res += 1
		idx += 1
print(res)


n = int(input())
l = list(map(int, input().split()))
l.sort()
k = 1
ans = 0
s = 0
while len(l) > 0 and s < n:
	if k <= l[s]:
		ans += 1
		k += 1
	s += 1
print(ans)


N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
cur = 1
while A:
	if A[-1] >= cur:
		ans += 1
		cur += 1
	A.pop()
print(ans)


n = int(input())
l = input().split()
l = [int(i) for i in l]
l.sort()
cont = 0
for i in range(n):
	if l[i] >= cont + 1:
		cont += 1
print(cont)


n = int(input())
a = list(map(int, input().split()))
a.sort()
(c, p) = (0, 1)
for v in a:
	if v >= p:
		c += 1
		p += 1
print(c)


def main():
	m = int(input())
	vals = [int(v) for v in input().split()]
	vals.sort()
	i = 0
	cur = 1
	while i < m:
		if vals[i] < cur:
			i += 1
		else:
			i += 1
			cur += 1
	print(cur - 1)
main()


n = int(input())
s = list(map(int, input().split()))
s.sort()
tmp = 1
r = 0
for i in s:
	if i >= tmp:
		tmp += 1
		r += 1
print(r)


def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
n = getN()
con = getList()
con.sort()
ans = 0
tmp = 0
while ans < n and tmp < n:
	pro = con[tmp]
	if ans + 1 <= pro:
		ans += 1
	tmp += 1
print(ans)


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
N = INT()
A = LIST()
A.sort()
cnt = 0
for a in A:
	if a > cnt:
		cnt += 1
print(cnt)


n = int(input())
A = [int(n) for n in input().split()]
A.sort()
i = 0
count = 0
index = 1
while i < n:
	if A[i] >= index:
		count += 1
		index += 1
	i += 1
print(count)


rub = input()
f = input().split()
for i in range(len(f)):
	f[i] = int(f[i])
f = sorted(f)
threshold = 1
for x in f:
	if x < threshold:
		continue
	threshold += 1
print(threshold - 1)


n = int(input())
l = list(map(int, input().split()))
day = 1
l.sort()
l.pop(0)
for t in l:
	if t >= day + 1:
		day = day + 1
print(day)


n = int(input())
l = list(map(int, input().split()))
count = 0
days = 1
l.sort()
for i in range(n):
	if l[i] >= days:
		days += 1
		count += 1
print(count)


IN = input
rint = lambda : int(IN())
rmint = lambda : list(map(int, IN().split()))
rlist = lambda : list(rmint())
n = rint()
a = rlist()
a.sort()
k = 1
for c in a:
	if c >= k:
		k += 1
print(k - 1)


n = int(input())
l1 = [int(x) for x in input().split()]
l1.sort()
day = 1
i = 0
while i < len(l1):
	if l1[i] < day:
		pass
	else:
		day += 1
	i += 1
print(day - 1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
r = 0
i = 1
for aa in a:
	if aa >= i:
		r += 1
		i += 1
print(r)


n = int(input())
contestQ = [int(i) for i in input().split()]
contestQ.sort()
d = 1
for i in range(n):
	if contestQ[i] >= d:
		d += 1
print(d - 1)


n = int(input())
a = sorted(list(map(int, input().split())))
i = 0
otv = 0
k = 1
while i < n:
	if a[i] >= k:
		k += 1
		otv += 1
		i += 1
	else:
		i += 1
print(otv)


n = int(input())
arr = [int(i) for i in input().split()]
arr = list(sorted(arr))
position = 1
for i in range(len(arr)):
	if arr[i] >= position:
		position += 1
print(position - 1)


from math import sqrt, ceil, floor, gcd, factorial
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
import string
import bisect

def solve():
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	ans = 0
	i = 0
	while i < n:
		if a[i] >= ans + 1:
			ans += 1
			i += 1
		else:
			i += 1
	print(ans)
solve()


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
j = 1
count = 0
for i in arr:
	if j <= i:
		count += 1
		j += 1
	else:
		continue
print(count)


n = int(input())
an = sorted(list(map(int, input().split())))
i = 0
now = 1
day = 0
while i < n:
	if an[i] >= now:
		now += 1
		day += 1
	i += 1
print(day)


n = int(input())
array = sorted([int(numeric_string) for numeric_string in input().split(' ')])
i = 0
d = 1
while i < n:
	if array[i] >= d:
		d += 1
	i += 1
print(d - 1)


(n, v) = (int(input()), 0)
for ai in sorted(map(int, input().split())):
	if ai > v:
		v += 1
print(v)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
cnt = 0
j = 1
for i in range(n):
	if arr[i] >= j:
		cnt += 1
		j += 1
print(cnt)


n = int(input())
A = list(map(int, input().split()))
A.sort()
i = 0
ans = 0
while i < n:
	if A[i] >= ans + 1:
		ans += 1
		i += 1
	elif A[i] < i + 1:
		i += 1
print(ans)


t = int(input())
arr = input()
arr = arr.split()
arr = list(map(int, arr))
arr.sort()
pos = 1
for element in arr:
	if pos <= element:
		pos = pos + 1
print(pos - 1)


a = [int(z) for z in input().split(' ')]
x = list(map(int, input().split(' ')))
n = len(x)
y = sorted(x)
q = 1
for i in range(n):
	if int(y[i]) >= q:
		q += 1
print(q - 1)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = 0
i = 1
while a:
	ai = a.pop()
	if ai >= i:
		i += 1
		ans += 1
print(ans)


input()
x = sorted([int(i) for i in input().split()])
ans = 0
c = 1
for i in x:
	if i >= c:
		c += 1
print(c - 1)


n = int(input())
a = input().split()
for i in range(len(a)):
	a[i] = int(a[i])
a.sort()
(day, i, days) = (1, 0, 0)
while i < len(a):
	if a[i] >= day:
		day += 1
		days += 1
		i += 1
	else:
		i += 1
print(days)


def main():
	from sys import stdin, stdout

	def read():
		return stdin.readline().rstrip('\n')

	def read_array(sep=None, maxsplit=-1):
		return read().split(sep, maxsplit)

	def read_int():
		return int(read())

	def read_int_array(sep=None, maxsplit=-1):
		return [int(a) for a in read_array(sep, maxsplit)]

	def write(*args, **kwargs):
		sep = kwargs.get('sep', ' ')
		end = kwargs.get('end', '\n')
		stdout.write(sep.join((str(a) for a in args)) + end)

	def write_array(array, **kwargs):
		sep = kwargs.get('sep', ' ')
		end = kwargs.get('end', '\n')
		stdout.write(sep.join((str(a) for a in array)) + end)
	n = read_int()
	a = read_int_array()
	a.sort()
	out = 0
	for x in a:
		if x >= out + 1:
			out += 1
	write(out)
main()


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
counter = 0
i = 1
uk = 0
while uk < n:
	if a[uk] < i:
		uk += 1
	else:
		counter += 1
		uk += 1
		i += 1
print(counter)


t = int(input(''))
a = list(map(int, input().split()))
a.sort()
j = 1
for i in range(t):
	if a[i] >= j:
		j += 1
print(j - 1)


n = int(input())
contests_count = [int(x) for x in input().split()]
contests_count.sort()
day = 1
days_counter = 0
for i in contests_count:
	if day <= i:
		days_counter += 1
		day += 1
print(days_counter)


n = int(input())
a = [int(x) for x in input().split()]
a = sorted(a)
i = 0
res = 0
while i < n:
	if a[i] < res + 1:
		i += 1
	else:
		i += 1
		res += 1
print(res)


from sys import stdin, stdout
from collections import Counter

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

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

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
n = ip()
li = ai()
li.sort()
days = 0
k = 1
for i in li:
	if i >= k:
		days += 1
		k += 1
op(days)


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


from collections import OrderedDict
t = int(input())
l = list(map(int, input().split()))
f = 0
k = 1
l.sort()
for i in range(0, t, 1):
	if l[i] >= k:
		k += 1
		f += 1
print(f)


def main():
	n = int(input())
	a = [int(i) for i in input().split()]
	days = 0
	a.sort()
	for i in range(n):
		if a[i] > days:
			days += 1
	print(days)
main()


N = int(input())
ls = list(map(int, input().split()))
ls.sort()
cnt = 0
i = 0
j = 0
try:
	while True:
		while ls[i] <= j:
			i += 1
		cnt += 1
		i += 1
		j += 1
except:
	pass
print(cnt)


number = input()
contest = [int(v) for v in input().split(' ')]
contest = sorted(contest)
need = 1
for v in contest:
	if v == need or v > need:
		need = need + 1
need = need - 1
print(need)


a = int(input())
b = list(map(int, input().split()))
b.sort()
p = 0
t = 0
for j in range(a):
	while t < a and j + 1 > b[t]:
		t += 1
	if t == a:
		break
	else:
		p += 1
	t += 1
print(p)


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


def number_of_days(arr, n):
	arr.sort()
	i = 0
	num_days = 0
	day = 1
	while i < n:
		if arr[i] >= day:
			num_days += 1
			day += 1
		i += 1
	return num_days

def get_input(flag=0):
	if flag:
		return int(input())
	return [int(num) for num in input().split()]
n = get_input(1)
arr = get_input()
print(number_of_days(arr, n))


n = int(input())
problems = [int(i) for i in input().split()]
problems.sort()
n = len(problems)
myProb = []
j = 1
for i in range(n):
	number = problems[i]
	if j <= number:
		myProb.append(i + 1)
		j += 1
print(len(myProb))


n = int(input())
a = [int(x) for x in input().split(' ')]
j = 0
q = 0
a.sort()
if len(set(a)) == n:
	print(n)
	exit()
for i in range(n):
	if a[i] >= q + 1:
		j += 1
		q += 1
print(j)


from bisect import *
n = int(input())
l = [int(i) for i in input().split(' ')]
l.sort()
out = 1
i = bisect_left(l, out)
last_i = i
while i != n:
	out += 1
	i = bisect_left(l, out, last_i + 1)
	last_i = i
print(out - 1)


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


(n, a, now) = (int(input()), sorted(list(map(int, input().split()))), 1)
for i in range(n):
	now += 1 if a[i] >= now else 0
print(now - 1)


import sys
n = int(input())
a = list(map(int, input().strip().split()))
a = sorted(a)
tosolve = 1
i = 0
while i < n:
	if tosolve <= a[i]:
		tosolve += 1
		i += 1
	else:
		while i < n and a[i] < tosolve:
			i += 1
print(tosolve - 1)


n = int(input())
data = sorted([int(v) for v in input().split()])
res = 0
start = 0
for i in range(n):
	found = False
	for j in range(start, n):
		v = data[j]
		if v > i:
			found = True
			break
	if not found:
		break
	else:
		res += 1
		start = j + 1
print(res)


n = int(input())
numbs = list(map(int, input().split()))
numbs.sort()
k = 1
m = 0
i = 0
while i < n:
	if numbs[i] >= k:
		k += 1
		i += 1
		m += 1
	else:
		i += 1
print(m)


n = int(input())
s = input().split()
s = list(s)
for i in range(n):
	s[i] = int(s[i])
s.sort()
c = 0
d = 0
for i in range(n):
	if s[i] >= d + 1:
		c += 1
		d = d + 1
print(c)


x = int(input())
y = list(map(int, input().split()))
y.sort()
k = 1
for i in y:
	if k > i:
		continue
	else:
		k += 1
print(k - 1)


n = int(input())
l = [*map(int, input().split())]
l.sort()
Day = 1
i = 0
while i < n:
	if Day <= l[i]:
		Day += 1
		i += 1
	else:
		i += 1
print(Day - 1)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
lens = RI()
elem = sorted(RMI())
done = 0
for i in elem:
	done += i > done
print(done)


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


def main():
	input()
	s = list(map(int, input().split()))
	s.sort()
	ans = 0
	for i in s:
		if i > ans:
			ans += 1
	print(ans)
main()


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
cur = 1
for i in range(n):
	if a[i] >= cur:
		cur += 1
print(cur - 1)


n = int(input())
a = sorted(list(map(int, input().split()))) + [0]
days = 0
for ai in a:
	if ai > days:
		days += 1
print(days)


n = int(input())
a = list(map(int, input().split()))
a.sort()
k = 0
day = 0
while k < n:
	if day + 1 <= a[k]:
		day += 1
		k += 1
	else:
		while k < n and day + 1 > a[k]:
			k += 1
		if k < n:
			day += 1
		k += 1
print(day)


N = int(input())
Contests = sorted(list(map(int, input().split())))
(Problems, i) = (1, 0)
while i < N:
	if Contests[i] >= Problems:
		Problems += 1
	i += 1
print(Problems - 1)


n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
i = 0
while A:
	x = A.pop()
	if x >= i + 1:
		i += 1
	else:
		continue
print(i)


import sys
n = map(int, sys.stdin.readline().split())
contestnums = list(map(int, sys.stdin.readline().split()))
contestnums.sort()
days = 0
for contest in contestnums:
	if contest >= days + 1:
		days += 1
print(days)


n = int(input())
l = list(map(int, input().split()))
l.sort()
k = 1
i = 0
while i < len(l):
	if l[i] >= k:
		k += 1
		i += 1
	else:
		i += 1
print(k - 1)


a = int(input())
x = list(map(int, input().split()))
x.sort()
c = 0
w = 0
k = 1
while w < a:
	for i in range(a):
		if x[i] >= k:
			c += 1
			k += 1
		w += 1
print(c)


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
c = 1
for i in arr:
	if i < c:
		continue
	c += 1
print(c - 1)


t = int(input())
k = list(map(int, input().split()))
k.sort()
day = 1
count = 0
for i in range(t):
	if k[i] >= day:
		count = count + 1
		day = day + 1
print(count)


import heapq
n = int(input())
pq = [int(x) for x in input().split()]
heapq.heapify(pq)
k = 1
while len(pq):
	if heapq.heappop(pq) >= k:
		k += 1
print(k - 1)


from collections import Counter
import os
import sys
from io import BytesIO, IOBase
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')
import sys
n = sys.stdin.readline()
n = int(n)
arr = list(map(int, input().split()))
arr.sort()
var = 1
cnt = 0
for i in range(n):
	if arr[i] >= var:
		cnt += 1
		var += 1
	else:
		pass
print(cnt)


n = int(input())
l = sorted(list(map(int, input().split())))
pos = 1
for i in range(len(l)):
	if l[i] >= pos:
		pos = pos + 1
print(pos - 1)


n = int(input(''))
L = [int(x) for x in input('').split()]
L.sort()
exists = True

def advance(L, i):
	n = len(L)
	while i < n - 1 and L[i] == L[i + 1]:
		i += 1
	return i + 1
day = 1
counter = 0
total = 0
while counter < n:
	if L[counter] >= day:
		total += 1
		counter += 1
		day += 1
	else:
		counter = advance(L, counter)
print(total)


_ = input()
probs = sorted(map(int, input().split(' ')))
looking = 1
for c in probs:
	if c >= looking:
		looking += 1
print(looking - 1)


n = int(input())
Array = list(map(int, input().split()))
Array.sort()
k = 1
j = 0
while j < len(Array):
	if Array[j] >= k:
		j = j + 1
		k = k + 1
	else:
		j = j + 1
print(k - 1)


n = int(input())
li = sorted([int(i) for i in input().split()])
day = 0
for i in li:
	if i > day:
		day = day + 1
print(day)


input()
li = list(map(int, input().split(' ')))
li.sort()
day = 1
for i in range(0, len(li)):
	if li[i] >= day:
		day += 1
	else:
		pass
print(day - 1)


n = int(input())
arr = [i for i in map(int, input().split())]
arr.sort()
k = 1
c = 0
flag = 0
j = 0
mark = [int(i + 1) for i in range(n)]
i = 0
j = 0
while i < n and j < n:
	if arr[i] >= mark[j]:
		c += 1
		i += 1
		j += 1
	else:
		while i < n and arr[i] < mark[j]:
			i += 1
print(c)


import sys
input = sys.stdin.readline
n = int(input())
contests = list(map(int, input().split()))
contests.sort()
cur = 1
i = 0
while i <= n - 1:
	if cur <= contests[i]:
		cur += 1
		i += 1
		continue
	i += 1
print(cur - 1)


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


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.sort()
	day = 0
	for i in range(len(arr)):
		if day + 1 > arr[i]:
			continue
		else:
			day += 1
	print(day)
solve()


n = int(input())
conc = list(map(int, input().split()))
conc.sort()
total = 0
diaspo = 1
indice = 0
while diaspo <= n:
	if conc[indice] >= diaspo:
		diaspo += 1
		indice += 1
		total += 1
	elif conc[indice] < diaspo:
		indice += 1
	if indice >= n:
		break
print(total)


n = int(input())
l = sorted(list(map(int, input().split())))
i = 0
day = 1
while i < n:
	if l[i] >= day:
		day += 1
	i += 1
print(day - 1)


n = int(input())
arr = sorted([int(x) for x in input().split()])
i = 0
k = 1
ans = 0
while i < n:
	if k <= arr[i]:
		ans += 1
		k += 1
	i += 1
print(ans)


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a.sort()
	days = 1
	for v in a:
		if v >= days:
			days += 1
	print(days - 1)


import sys, os
f = lambda : list(map(int, input().split()))
if 'local' in os.environ:
	sys.stdin = open('./input.txt', 'r')

def solve():
	n = f()[0]
	a = f()
	a = sorted(a)
	ans = 0
	k = 1
	for i in a:
		if i >= k:
			ans += 1
			k += 1
	print(ans)
solve()


n = int(input())
a = list(map(int, input().split()))
aa = sorted(a)
count = 0
i = 0
while i < n:
	if aa[i] > count:
		count += 1
		i += 1
	else:
		flag = -1
		for j in range(i, n):
			if aa[j] > count:
				flag = j
				break
		if flag is not -1:
			i = j + 1
			count += 1
		else:
			break
print(count)


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


def contest_solver(n, a):
	a = sorted(a)
	counter = 1
	for x in a:
		if x >= counter:
			counter += 1
	return counter - 1
n = int(input())
a = list(map(int, input().split()))
print(contest_solver(n, a))


from collections import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
n = ri()
a = rl()
a.sort()
a = deque(a)
temp = 0
ans = 0
k = 1
while a:
	temp = a.popleft()
	while temp < k and a:
		temp = a.popleft()
	if temp >= k:
		ans += 1
		k += 1
print(ans)


cont = int(input())
cont_zad = list(map(int, input().split()))
day = 1
cont_zad.sort()
for i in range(len(cont_zad)):
	if cont_zad[i] >= day:
		day = day + 1
	else:
		cont = cont - 1
print(day - 1)


def shag(list1, list2):
	i = 0
	j = 0
	imax = len(list1)
	jmax = len(list2)
	newlist = [[0] for k in range(imax + jmax)]
	while i < imax and j < jmax:
		if list1[i] < list2[j]:
			newlist[i + j] = list1[i]
			i = i + 1
		else:
			newlist[i + j] = list2[j]
			j = j + 1
	if i == imax:
		while j < jmax:
			newlist[i + j] = list2[j]
			j = j + 1
	else:
		while i < imax:
			newlist[i + j] = list1[i]
			i = i + 1
	return newlist

def listsort(mylist, k=1):
	list1 = mylist[0:len(mylist) // 2]
	list2 = mylist[len(mylist) // 2:len(mylist)]
	if k == 0:
		return shag(list1, list2)
	elif len(mylist) > 1:
		return shag(listsort(list1), listsort(list2))
	else:
		return listsort(mylist, 0)
n = int(input())
a = list(map(int, input().split()))
a = listsort(a)
c = 0
d = 1
for i in range(1, n + 1):
	if a[i - 1] >= d:
		c = c + 1
		d = d + 1
print(c)


a = int(input())
b = list(map(int, input().split()))
b.sort()
k = 1
l = []
for i in b:
	if i >= k:
		k += 1
print(k - 1)


s = int(input())
l = list(map(int, input().split(' ')))
l.sort()
p = 1
for x in l:
	if p <= x:
		p += 1
print(p - 1)


n = int(input())
contests = map(int, input().split())
num_probs = 1
solved = 0
for c in sorted(contests):
	if c < num_probs:
		continue
	elif c >= num_probs:
		num_probs += 1
		solved += 1
		continue
print(solved)


n = int(input())
ls = sorted(list(map(int, input().split())))
c = 1
for i in range(n):
	if ls[i] >= c:
		c += 1
print(c - 1)


n = int(input())
a = [int(t) for t in input().split()]
a.sort()
pos = 1
for num in a:
	if num >= pos:
		pos += 1
print(pos - 1)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	res = 0
	a.sort(reverse=True)
	nowvalue = 1
	while a:
		x = a.pop()
		if nowvalue <= x:
			res += 1
			nowvalue += 1
	print(res)
	return

def main():
	t = 1
	for i in range(t):
		solve()
	return
main()


n = input()
ith = input().split(' ')
ith = [int(i) for i in ith]
ith = sorted(ith)
days = 0
for i in ith:
	if int(i) > days:
		days += 1
print(days)


n = int(input())
l = list(map(int, input().split()))
l.sort()
k = 1
ans = 0
for i in range(n):
	if l[i] >= k:
		ans = ans + 1
		k += 1
	else:
		i += 1
print(ans)


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
d = 1
ans = 0
for i in range(n):
	if arr[i] >= d:
		ans += 1
		d += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
d = {}
cnt = 1
a.sort()
for j in a:
	if j >= cnt:
		cnt += 1
print(cnt - 1)


N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
Max = 9999999999999999999999
for (a, b) in zip(range(N), A):
	Temp = a + b
	if Max > Temp:
		Max = Temp
if Max > N:
	print(N)
else:
	print(Max)


n = int(input())
a = sorted(map(int, input().split()))
k = 1
for i in range(len(a)):
	if a[i] >= k:
		k += 1
print(k - 1)


numOfContests = int(input())
contests = list(map(int, input().split()))
contests.sort()
counter = 0
tasksToday = 1
for i in range(1, numOfContests + 1):
	if contests[i - 1] >= tasksToday:
		counter += 1
		tasksToday += 1
		continue
print(counter)


def main():
	n = int(input())
	arr = [int(a) for a in input().split()]
	arr = sorted(arr)
	count = 0
	i = 0
	while i < n:
		if arr[i] >= count + 1:
			count += 1
			i += 1
		else:
			i += 1
	print(count)
main()


num = input()
tests = input()
test_list = sorted(tests.split(' '), key=lambda x: int(x))
day = 0
for entry in test_list:
	if int(entry) >= day + 1:
		day += 1
print(day)


n = int(input())
l = [int(n) for n in input().split()]
l = sorted(l)
c = 0
k = 0
flag = 0
for i in range(1, n + 1):
	for j in range(k, n):
		k += 1
		if l[j] >= i:
			flag = 1
			c += 1
			break
	if flag == 0:
		break
	flag = 0
print(c)


n = int(input())
x = list(map(int, input().split()))
x.sort()
a = []
count = 0
for i in range(n):
	if x[i] > i or count < x[i] <= i:
		a.append(x[i])
		count += 1
print(len(a))


n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 0
i = 0
for el in a:
	if el >= i + 1:
		d += 1
		i += 1
print(d)


def polycarp(n, poly):
	poly = sorted(poly)
	(days, ans) = (0, 0)
	for i in range(1, n + 1):
		while days < n and poly[days] < i:
			days += 1
		if days < n and poly[days] >= i:
			ans += 1
		days += 1
	print(ans)
n = int(input())
poly = list(map(int, input().split()))
polycarp(n, poly)


nc = int(input())
np = list(map(int, input().split()))
np.sort()
tempo = 0
for x in np:
	if x >= tempo + 1:
		tempo += 1
print(tempo)


n = int(input())
b = list(list(map(int, input().split())))
b.sort()
j = 1
count = 0
for x in b:
	if x >= j:
		count += 1
		j += 1
print(count)


n = int(input())
count = 0
str1 = sorted(map(int, input().split()))
for i in str1:
	if i >= count + 1:
		count += 1
print(count)


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


n = int(input())
a = list(map(int, input().split()))
a.sort()
p = 1
for i in a:
	if i >= p:
		p += 1
print(p - 1)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
j = 1
for i in range(len(a)):
	if a[i] >= j:
		j += 1
print(j - 1)


n = int(input())
line = input()
li = line.split()
li = [int(i) for i in li]
li.sort()
day = 0
for i in li:
	if i >= day + 1:
		day = day + 1
print(day)


n = int(input())
s = str(input())
temp = s.split(' ')
l = []
for i in temp:
	l.append(int(i))
count = 0
counter = 1
l.sort()
for i in range(0, n):
	if l[i] >= counter:
		count += 1
		counter += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
k = 1
j = 0
flag = 1
while j < n:
	if k <= a[j]:
		k += 1
		j += 1
	else:
		j += 1
print(k - 1)


n = int(input())
line = input().split()
a = [int(x) for x in line]
a.sort()
ans = 0
cur = 1
for x in a:
	if x >= cur:
		ans += 1
		cur += 1
print(ans)


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


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


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


quant = int(input())
concu = input().split()
for x in range(quant):
	concu[x] = int(concu[x])
cont = 0
concu = sorted(concu)
dia = 1
indice = 0
while dia <= quant:
	if concu[indice] >= dia:
		dia = dia + 1
		cont = cont + 1
		indice = indice + 1
	elif concu[indice] < dia:
		indice = indice + 1
	if indice >= quant:
		break
print(cont)


n = int(input())
A = list(map(int, input().split()))
count = 0
A.sort()
A.append(-1)
k = 1
for i in range(n):
	if A[i] == -1:
		break
	if A[i] >= k:
		count += 1
		k += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
count = 0
j = 1
for i in range(n):
	if a[i] >= j:
		count += 1
		j += 1
		continue
print(count)


number = int(input())
L = [int(x) for x in input().split()]
day = 0
L.sort()
for i in range(len(L)):
	if day + 1 <= L[i]:
		day += 1
print(day)


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
n = int(input())
p = 1
for i in sorted(list(map(int, input().split()))):
	if p <= i:
		p += 1
print(str(p - 1))


n = int(input())
contests = list(map(int, input().split()))
contests.sort()
pos = 1
for x in contests:
	if x >= pos:
		pos += 1
print(pos - 1)


m = int(input())
l = list(map(int, input().split()))
c = 1
co = 0
l = sorted(l)
for i in range(0, len(l)):
	if l[i] >= c:
		c += 1
		co += 1
print(co)


n = int(input())
ar = list(map(int, input().split()))
p = sorted(ar)
k = 1
i = 0
count = 0
while i < n:
	if p[i] >= k:
		p[i] = 0
		count += 1
		k += 1
	else:
		i += 1
print(count)


n = int(input())
arr = input()
l = list(map(int, arr.split()))
l.sort()
ANS = 1
for i in range(n):
	if l[i] >= ANS:
		ANS = ANS + 1
print(ANS - 1)


n = int(input())
li1 = list(map(int, input().split()))
li1.sort()
cn = 1
for j in li1:
	if j >= cn:
		cn += 1
print(cn - 1)


n = int(input())
problems = [int(x) for x in input().split()]
problems.sort()
day = 0
for i in range(n):
	if problems[i] >= day + 1:
		day += 1
print(day)


def arr_inp():
	return [int(x) for x in input().split()]
(n, a) = (int(input()), arr_inp())
a.sort()
days = 0
for i in a:
	if i >= days + 1:
		days += 1
print(days)


n = int(input())
a = list(map(int, input().split()))
a.sort()
days = 0
j = 0
for k in range(1, n + 1):
	while j < n:
		if a[j] >= k:
			days += 1
			j += 1
			break
		j += 1
	if j >= n:
		break
print(days)


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
from math import *
from decimal import *
from copy import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN(x=' '):
	return map(int, sys.stdin.readline().strip().split(x))

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN():
	return list(numIN())

def dis(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)

def res(ans, t):
	print('Case #{}: {} {}'.format(t, ans[0], ans[1]))
n = int(input())
a = arrIN()
cnt = 0
a.sort()
j = 0
for i in range(1, n + 1):
	if a[j] >= i:
		cnt += 1
		j += 1
		if j == n:
			print(cnt)
			exit(0)
	else:
		while i > a[j]:
			j += 1
			if j == n:
				print(cnt)
				exit(0)
		if a[j] >= i:
			cnt += 1
			j += 1
		if j == n:
			print(cnt)
			exit(0)
print(cnt)


input()
x = list(map(int, input().strip().split()))
x.sort()
counter = 1
for i in range(len(x)):
	if x[i] < counter:
		continue
	else:
		counter += 1
counter -= 1
print(counter)


import math
n = int(input())
data = list(map(int, input().split()))
data.sort()
cnt = 0
k = 1
for i in range(n):
	if data[i] >= k:
		cnt += 1
		k += 1
print(cnt)


import sys
n = int(sys.stdin.readline())
competitions = [int(prob) for prob in sys.stdin.readline().split()]
competitions.sort()
(i, ans) = (1, 0)
idx = 0
while idx < n:
	while idx < n and competitions[idx] < i:
		idx += 1
	if idx < n:
		ans += 1
		idx += 1
		i += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
j = 1
c = 0
l.sort()
for i in l:
	if j <= i:
		c = c + 1
		j = j + 1
print(c)


def main():
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	d = 1
	for i in a:
		if i < d:
			continue
		d += 1
	print(d - 1)
main()


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


n = int(input())
a = sorted([int(i) for i in input().split()])
j = 0
for i in range(1, n + 1):
	while j < n and a[j] < i:
		j += 1
	if j == n or a[j] < i:
		i -= 1
		break
	else:
		j += 1
print(i)


n = int(input())
numbers = list(map(int, input().split()))
numbers.sort()
counter = 0
k = 1
i = 0
while i < n:
	if numbers[i] >= k:
		counter += 1
		k += 1
	i += 1
print(counter)


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


a = int(input())
b = 1
ct = 0
l = sorted(map(int, input().split()))
for i in range(a):
	if l[i] >= b:
		ct += 1
		b += 1
print(ct)


n = int(input())
a = list(sorted([int(x) for x in input().split()]))
j = 1
for i in range(n):
	if a[i] >= j:
		j += 1
print(j - 1)


n = int(input())
ar = [int(x) for x in input().split()]
ar.sort()
i = 1
j = 0
while j < n:
	if ar[j] >= i:
		i += 1
	j += 1
print(i - 1)


n = int(input())
l = sorted(map(int, input().split()))
i = 0
res = 0
while i < n:
	if res < l[i]:
		res += 1
	i += 1
print(res)


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
lx = lambda x: map(int, input().split(x))
n = t()
a = list(ll())
a.sort()
k = 1
for i in a:
	if k <= i:
		k += 1
print(k - 1)


from collections import Counter
n = int(input())
l = sorted(list(map(int, input().split())))
t = 0
i = 0
while i < n:
	if l[i] >= t + 1:
		t += 1
	i += 1
print(t)


n = int(input())
a = list(map(int, input().split()))
q = sorted(a)
c = 1
i = 0
d = []
while i < len(a):
	while i < len(a) and q[i] >= c:
		d.append(q[i])
		i += 1
		c += 1
	i += 1
print(len(d))


import sys
input = sys.stdin.readline().strip()
input1 = sys.stdin.readline().strip().split()
list2 = [int(x) for x in input1]
list2.sort()
day = 1
for x in list2:
	if x >= day:
		day += 1
print(day - 1)


def main():
	n = int(input())
	a = sorted([int(i) for i in input().split()])
	ans = 0
	k = 1
	for i in range(n):
		if a[i] >= k:
			a[i] -= k
			ans += 1
			k += 1
	print(ans)
main()


n = int(input())
a = [int(s) for s in input().split()]
a.sort()
k = 1
for i in range(n):
	if a[i] - k > -1:
		k += 1
	else:
		i += 1
print(k - 1)


n = int(input())
s = sorted(list(map(int, input().split())))
round = 1
for i in s:
	if i >= round:
		round += 1
print(round - 1)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
pointer = 0
k = 1
count = 0
while pointer < len(arr):
	if arr[pointer] >= k:
		k += 1
		pointer += 1
		count += 1
	else:
		pointer += 1
print(count)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
cnt = 0
counter = 0
while cnt < len(a):
	if a[cnt] < counter + 1:
		cnt += 1
	elif a[cnt] >= counter + 1:
		cnt += 1
		counter += 1
print(counter)


n = int(input())
lst = sorted(list(map(int, input().strip().split())))[:n]
counter = 1
for i in range(len(lst)):
	if lst[i] >= counter:
		counter += 1
print(counter - 1)


import math
from collections import defaultdict
import sys

def main():
	n = int(input())
	a = sorted(list(map(int, input().split())))
	days = 0
	pos = 0
	while pos < n:
		while pos < n and a[pos] < days + 1:
			pos += 1
		if pos >= n:
			break
		days += 1
		pos += 1
	print(days)
main()


n = int(input())
a = list(map(int, input().split()))
b = [0] * 1000000
max_i = 0
k = 0
for i in a:
	b[i] += 1
	if i > max_i:
		max_i = i
for i in range(max_i + 1):
	if b[i]:
		if b[i] >= i - k:
			k = i
		else:
			k += b[i]
print(k)


n = input()
m = input().split(' ')
n = int(n)
m = [int(i) for i in m]
m.sort()
rez = 0
j = 0
for i in range(1, n + 1):
	if j > n - 1:
		break
	while i > m[j]:
		j += 1
		if j > n - 1:
			break
	if j > n - 1:
		break
	if i <= m[j]:
		j += 1
		rez += 1
print(rez)


def main():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	ans = 0
	cnt = 1
	last_number = -1
	for i in range(n):
		if cnt <= l[i]:
			ans += 1
			cnt += 1
			last_number = l[i]
		else:
			continue
	print(ans)
main()


a = input()
b = input()
c = b.split()
if len(c) != int(a):
	print('False input')
else:
	for i in range(len(c)):
		c[i] = int(c[i])
	c.sort()
	res = 0
	for i in range(len(c)):
		if c[i] > res:
			res += 1
	print(res)


n = int(input())
d = 1
for i in sorted(map(int, input().split())):
	if i >= d:
		d += 1
print(d - 1)


n = int(input())
p = list((int(a) for a in input().split()))
d = 1
i = 0
p.sort()
while i < n:
	if p[i] >= d:
		d += 1
	i += 1
print(d - 1)


n = int(input())
l = list(map(int, input().split()))
l.sort()
count = 0
i = 0
t = 1
while i < n and count <= n:
	if l[i] >= t:
		count = count + 1
		t = t + 1
	i = i + 1
print(count)


n = int(input())
A_n = input().split()
a_n = [int(val) for val in A_n]
a_n.sort()
if n == 0:
	print(0)
	exit()
elif n == 1:
	print(1)
	exit()
else:
	count = 0
k = 1
for j in range(n):
	if a_n[j] >= k:
		count += 1
		k += 1
	else:
		pass
print(count)


n = int(input())
lis = list(map(int, input().split()))
lis.sort()
c = 0
d = 1
i = 0
while i < n:
	if d <= lis[i]:
		d += 1
		c += 1
	i += 1
print(c)


n = int(input())
problemas = list(map(int, input().split()))
dias = 0
questoes = 1
problemas.sort()
for e in problemas:
	if questoes <= e:
		questoes += 1
		dias += 1
print(dias)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
days = 0
k = 1
for i in range(len(a)):
	if a[i] >= k:
		k += 1
		days += 1
print(days)


n = int(input())
a = sorted(list(map(int, input().split())))
s = 0
r = 1
for x in a:
	if x >= r:
		s += 1
		r += 1
print(s)


from sys import stdin
n = int(stdin.readline())
numeros = [int(x) for x in stdin.readline().split()]
numeros.sort()
dia = 1
contador = 0
for i in numeros:
	if i >= dia:
		dia += 1
		contador += 1
print(contador)


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


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


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 0
k = 1
for i in range(n):
	if a[i] >= k:
		d += 1
		k += 1
print(d)


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
l.sort()
ans = 0
cur = 1
for i in range(n):
	if l[i] >= cur:
		cur += 1
		ans += 1
print(ans)


x = int(input())
y = [int(i) for i in input().split()]
y.sort()
z = []
a = 1
for i in range(x):
	if y[i] >= a:
		z += [y[i]]
		a += 1
print(len(z))


n = int(input())
x = list(map(int, input().split()))
x.sort()
count = 1
s = 0
j = 0
while j < n:
	if x[j] >= count:
		s += 1
		count += 1
	j += 1
print(s)


n = int(input())
a = [*map(int, input().split())]
a.sort()
b = []
j = 1
for i in a:
	if i >= j:
		b.append(i)
		j += 1
print(len(b))


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
ans = 0
(n, a) = na()
a.sort()
k = 1
for i in range(n):
	if a[i] >= k:
		ans += 1
		k += 1
	else:
		continue
print(ans)


n = int(input().strip())
a = [int(i) for i in input().strip().split(' ')]
a.sort()
days = 0
for i in range(n):
	if a[i] >= days + 1:
		days += 1
print(days)


n = int(input())
l = input()
l = l.split(' ')
for i in range(len(l)):
	l[i] = int(l[i])
l.sort()
day = 0
for i in range(len(l)):
	if l[i] - (day + 1) >= 0:
		day = day + 1
print(day)


n = int(input())
lst = list(map(int, input().split()))
lst.sort()
dayCount = 0
for i in lst:
	if i >= dayCount + 1:
		dayCount += 1
print(dayCount)


from sys import stdin, setrecursionlimit
from bisect import bisect_right
setrecursionlimit(15000)

def get_gdict(arr):
	gdict = dict()
	for i in range(len(arr)):
		if arr[i] in gdict:
			gdict[arr[i]] += 1
		else:
			gdict[arr[i]] = 1
	return gdict

def initial_check(barr, garr):
	for i in garr:
		if i < barr[-1]:
			return False
	return True
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
arr.sort()
streak = 1
count = 0
i = 0
while i < n:
	if streak <= arr[i]:
		count += 1
		streak += 1
	i += 1
print(count)


contests = int(input())
contest_problems = input().split(' ')

def to_integer(contest_problems):
	for i in range(len(contest_problems)):
		contest_problems[i] = int(contest_problems[i])
polycarp_training = 0
current_day = 1
current_contest = 0
to_integer(contest_problems)
contest_problems.sort()
while current_day <= contests and current_contest < contests:
	if current_day <= int(contest_problems[current_contest]):
		polycarp_training += 1
		current_day += 1
		current_contest += 1
	else:
		current_contest += 1
print(polycarp_training)


qtd = int(input())
linha = input().split()
lista = list(map(int, linha))
lista.sort()
soma = 0
dias = 1
for i in range(qtd):
	if lista[i] >= dias:
		soma += 1
		dias += 1
print(soma)


n = int(input())
l = [int(i) for i in input().split()]
fl = 0
l = sorted(l)
for i in l:
	if fl < i:
		fl += 1
print(fl)


n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
count = 0
problems = 1
for i in range(0, len(a)):
	if a[i] >= problems:
		count += 1
		problems += 1
	else:
		continue
print(count)


def main():
	n = int(input())
	s = [int(x) for x in input().split()]
	s = sorted(s)
	day = 0
	i = 0
	while i < n:
		while i < n and day + 1 > s[i]:
			i += 1
		if i == n:
			break
		day += 1
		i += 1
	print(day)
main()


n = input()
b = input().split()
a = []
for i in b:
	a.append(int(i))
a.sort()
x = 1
y = 0
for i in range(int(n)):
	if x <= a[i]:
		y += 1
		x += 1
print(y)


t = int(input())
b = list(map(int, input().split()))
b.sort()
j = 1
i = 0
m = 0
while i < t:
	if b[i] >= j:
		m += 1
		j = j + 1
	i = i + 1
print(m)


n = int(input())
l = list(map(int, input().split(' ')))
l.sort()
z = 1
for i in range(len(l)):
	if l[i] >= z:
		z += 1
print(z - 1)


import sys
pos = 1
length = int(sys.stdin.readline())
contest_counts = list(map(int, sys.stdin.readline().split()))
contest_counts.sort()
for i in range(0, length):
	if contest_counts[i] >= pos:
		pos += 1
print(pos - 1)


def main():
	n = int(input())
	s = [int(i) for i in input().split()]
	s = sorted(s)
	p = 1
	for i in range(n):
		if s[i] >= p:
			p += 1
	print(p - 1)
main()


l = input()
ln = [int(i) for i in input().split(' ')]
ln = sorted(ln)[::-1]
li = ln[0]
oli = li
mli = li
for i in ln:
	if i < li and li > 0:
		oli = li
		li = i
		mli -= oli - li
	li -= 1
if li > 0:
	mli -= li
print(mli)


def training(n, list):
	nb = 1
	list.sort()
	for i in range(n):
		if nb <= list[i]:
			nb += 1
	return nb - 1
n = int(input())
list = list(map(int, input().split()))
print(training(n, list))


import sys
input = sys.stdin.readline
n = int(input())
l = [int(i) for i in input().split()]
l = sorted(l)
p = 0
ans = 0
day = 1
while p < n:
	if l[p] >= day:
		p += 1
		ans += 1
		day += 1
	else:
		p += 1
print(ans)


from collections import deque, defaultdict
import bisect
n = int(input())
arr = list(map(int, input().split()))
i = 1
arr.sort()
arr = deque(arr)
while True:
	if len(arr) == 0:
		break
	if i > arr[0]:
		arr.popleft()
	else:
		arr.popleft()
		i += 1
print(i - 1)


n = int(input())
s = list(map(int, input().split()))
s.sort()
ans = 0
day = 1
for i in s:
	if i >= day:
		ans += 1
	else:
		continue
	day += 1
print(ans)


n = int(input())
l = sorted(list(map(int, input().split())))
i = 0
k = 1
count = 0
while n:
	if l[i] >= k:
		count += 1
		k += 1
	i += 1
	n -= 1
print(count)


N = int(input())
A = sorted([int(a) for a in input().split()])
i = 0
d = 1
while d <= N and i < N:
	while A[i] < d:
		i += 1
		if i >= N:
			break
	if i >= N:
		break
	i += 1
	d += 1
print(d - 1)


from collections import Counter
n = int(input())
l = list(map(int, input().split()))
l.sort()
day = 1
n = 0
for i in l:
	if i >= day:
		day += 1
print(day - 1)


n = int(input())
l = list(map(int, input().split()))
l.sort()
count = 0
j = 1
i = j - 1
while i < n:
	if l[i] < j:
		i += 1
	else:
		count += 1
		j += 1
		i += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
need = 1
tot = 0
for have in a:
	if have >= need:
		tot += 1
		need += 1
print(tot)


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


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
l = gi()
l.sort()
ans = 0
day = 1
for e in l:
	if e >= day:
		ans += 1
		day += 1
print(ans)


def main():
	(ans, n) = (0, int(input()))
	arr = list(sorted(map(int, input().split())))
	day = 1
	for i in arr:
		if i >= day:
			ans += 1
			day += 1
	print(ans)
main()


n = int(input())
A = list(map(int, input().split()))
A.sort()
ANS = 1
for a in A:
	if a >= ANS:
		ANS += 1
print(ANS - 1)


n = int(input())
con = sorted([int(i) for i in input().split()])
d = 0
i = 0
while i < n:
	if d + 1 <= con[i]:
		d += 1
		con[i] -= d
	i += 1
print(d)


n = int(input())
arr = []
z = str(input()).split()
for i in range(n):
	arr.append(int(z[i]))
arr.sort()
day = 1
count = 0
for i in range(n):
	if arr[i] >= day:
		count += 1
		day += 1
print(count)


n = int(input())
a = list(sorted(map(int, input().split())))
t = 0
i = 0
l = 1
while i < n:
	if a[i] >= l:
		t += 1
		l += 1
	i += 1
print(t)


z = input
from math import ceil
n = int(z())
l = sorted(list(map(int, z().split())))
c = 0
for i in l:
	if i > c:
		c += 1
print(c)


num = int(input())
ls = list(map(int, input().split()))
ls.sort()
(i, j, count) = (0, 0, 0)
while i < num:
	if ls[i] >= j + 1:
		count += 1
		j += 1
	i += 1
print(count)


n = int(input())
data = list(map(int, input().split()))
data.sort()
res = 0
pointer = 0
for i in range(n):
	found = False
	while pointer < len(data) and (not found):
		if data[pointer] >= i + 1:
			res += 1
			found = True
		pointer += 1
print(res)


n = int(input())
ara = list(map(int, input().split()))
ara.sort()
ans = 0
v = 1
for i in range(n):
	if ara[i] >= v:
		ans += 1
		v += 1
print(ans)


import math
n = int(input())
seq = [int(x) for x in input().split()]
seq.sort()
ct = 0
pt = 0
for i in range(n):
	if pt >= n:
		break
	if seq[pt] >= i + 1:
		pt += 1
		ct += 1
	else:
		pt += 1
		while pt < n:
			if seq[pt] >= i + 1:
				ct += 1
				pt += 1
				break
			pt += 1
print(ct)


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
i = 1
count = 0
for a in arr:
	if i <= a:
		i += 1
		count += 1
	else:
		continue
print(count)


n = int(input())
a = [int(x) for x in input().split()]
ans = 0
a.sort()
day = 1
ind = 0
while ind < n:
	if a[ind] >= day:
		ans += 1
		ind += 1
		day += 1
	else:
		ind += 1
print(ans)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
cnt = 0
idx = 0
for i in range(1, max(arr) + 1):
	while arr[idx] < i:
		idx += 1
		if idx > n - 1:
			break
	if arr[idx] >= i:
		cnt += 1
		idx += 1
	if idx > n - 1:
		break
print(cnt)


input()
contests = list(map(int, input().split()))
contests.sort()
curr = 0
for contest in contests:
	if contest > curr:
		curr += 1
print(curr)


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
(count, d) = (0, 1)
for i in range(len(a)):
	if d <= a[i]:
		count += 1
		d += 1
print(count)


n = int(input())
a = list(map(int, input().split()))
a.sort()
k = 0
max_value = 0
for i in range(1, n + 1):
	while k < n and a[k] < i:
		k += 1
	if k == n:
		break
	max_value = i
	k += 1
print(max_value)


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
j = 1
count = 0
for i in range(n):
	if l[i] >= j:
		count += 1
		j += 1
print(count)


n = int(input())
arr = list(map(int, input().strip().split()))[:n]
arr.sort()
k = 1
i = 0
days = 0
while i < n:
	if arr[i] >= k:
		days += 1
		i += 1
		k += 1
	else:
		i += 1
print(days)


n = int(input())
a = list(map(int, input().split()))
a.sort()
d = 0
arr = []
for i in range(n):
	arr.append(i + 1)
c = 0
for i in range(n):
	if a[i] >= arr[c]:
		d += 1
		c += 1
print(d)


n = int(input())
S = list(map(int, input().split()))
ans = 0
S.sort()
i = 0
day = 0
while i < n:
	if S[i] >= day + 1:
		ans += 1
		day += 1
	i += 1
print(ans)


def polikarp(lst):
	position = 1
	for elem in lst:
		if elem >= position:
			position += 1
	return position - 1
n = int(input())
a = [int(i) for i in input().split()]
print(polikarp(sorted(a)))


am = int(input())
arr = list(map(int, input().split()))
arr.sort()
d = 1
ind = 0
fl = False
while ind < am:
	if arr[ind] >= d:
		d += 1
	ind += 1
print(d - 1)