Shane has just become a new swimming coach. One may even say he is very qual-leaf-fied for the job, since he has won several swimming competitions. However, because he is 16, he can only coach little children.
Shane has potential children he can coach for money. However, he must prove to the child's parent that he is qual-leaf-fied to teach. Shane will only be able to coach the
child if their parent sees that Shane has coached at least
children.
Shane is poor, so he wants to teach all children for money. He has no experience, so he decides to teach
other children for free first to rack up experience. Shane is also lazy, so he wants to know what the minimum value of
is, so he can earn money as soon as possible.
Constraints
Input Specification
The first line will contain a single integer , the number of potential children Shane can coach for money.
The next line will contain , represented by
space-separated integers.
is the minimum amount of children Shane must coach to be qual-leaf-fied to teach the
child.
Output Specification
Output , the minimum amount of children Shane must coach for free in order to coach all
children for money.
Sample Input 1
5
5 3 1 2 3
Sample Output 1
1
Sample Explanation 1
If Shane teaches one child for free, he can teach the child for money, while also gaining another coaching experience. Then, he can teach the
child he now has coached two children. He can then coach the
and
child, before finally teaching the
child. Note that if Shane does not coach one child for free, he cannot teach any of the
children for money.
Sample Input 2
20
2 3 53 6 12 6 3 21 6 2 3 42 2 6 12 3 5 6 1 34
Sample Output 2
34
Comments