N = int(eval(input()))

p = list(map(int, input().split()))

score = [0] * 101

for x in p:

    score[x] += 1

    

i = 1

while sum(score[i:]) >= i:

    i += 1

print((i-1))
N = int(eval(input()))

p = list(map(int, input().split()))

score = [0] * 101

for x in p:

    score[x] += 1



i = 1

while True:

    if sum(score[i:]) < i:

        break

    i += 1

print((i-1))
N = int(eval(input()))
p = list(map(int, input().split()))
score = [0] * 101
for x in p:
    score[x] += 1
i = 1
while sum(score[i:]) >= i:
    i += 1
print((i - 1))

N = int(eval(input()))
p = list(map(int, input().split()))
score = [0] * 101
for x in p:
    score[x] += 1
i = 1
while True:
    if sum(score[i:]) < i:
        break
    i += 1
print((i - 1))

-while sum(score[i:]) >= i: +while True: +    if sum(score[i:]) < i: +        break