A programming contest will be held at White Tiger University. Each contest question is assigned a score based on its difficulty level. The executive committee has decided to calculate each team's score based on the following rules:
For each team that answers questions correctly, the score is determined as follows:
Let A be the maximum score such that there are at least A questions answered correctly with a score of A or higher.
Your task is to write a program that calculates the team's score based on the number of questions answered correctly and the scores of those questions.
Input Format
The input consists of:
An integer N (1 ≤ N ≤ 100), the number of questions answered correctly by the team.
A line containing N integers p1, p2, ..., pN (1 ≤ pi ≤ 100), where each integer represents the score of a question answered correctly by the team.
Output Format
Print a single integer representing the team's score.
Examples
Example 1
Input:
text
7
5 4 3 10 2 4 1
Output:
text
4
Example 2
Input:
text
3
1 1 100
Output:
text
1
Example 3
Input:
text
4
11 15 58 1
Output:
text
3
Constraints
The number of questions answered correctly, N, must be between 1 and 100.
Each question's score must be between 1 and 100.
Solution Directory
Please place your solution code in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.