n=int(input())
p=0
L=list(map(int,input().split()))
L1=[0]*1000000
for i in range(n):
L1[L[i]]+=1
i=-1
while 1:
i+=1
if i<=n:
p=i
else:
break
n-=L1[i]
print(p)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
11080 KB |
Output is correct |
2 |
Correct |
41 ms |
11080 KB |
Output is correct |
3 |
Correct |
42 ms |
11080 KB |
Output is correct |
4 |
Correct |
43 ms |
11208 KB |
Output is correct |
5 |
Correct |
41 ms |
11080 KB |
Output is correct |
6 |
Correct |
41 ms |
11208 KB |
Output is correct |
7 |
Correct |
48 ms |
12204 KB |
Output is correct |
8 |
Correct |
134 ms |
16360 KB |
Output is correct |
9 |
Correct |
515 ms |
56992 KB |
Output is correct |
10 |
Correct |
312 ms |
30860 KB |
Output is correct |