시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB147666.667%

문제

Mirko is celebrating his birthday and wants to invite his friends to the cinema.

They all like going to the cinema in big groups. Everyone requests that besides Mirko and himself/herself the certain number of other Mirko's friends comes to the cinema with them.

Mirko doesn't have enough money to invite them all so he wants to invite minimal number of people. He must determine such minimal group that every person's request is satisfied and it consists of at least one person.

Help Mirko to write a program that computes that number.

입력

In the first row there is an integer N, 2 ≤ N ≤ 10 000, number of friends.

In the next N rows there is one integer per row Zi, 1 ≤ Zi < N. That numbers represent requests of all Mirko’s friends, that is, minimal number of people they are willing to go to the cinema with.

출력

In first and only row you should write minimal number of people Mirko can invite to the cinema.

예제 입력 1

2
1
1

예제 출력 1

2

예제 입력 2

3
1
2
1

예제 출력 2

2

예제 입력 3

5
3
4
3
3
3

예제 출력 3

4