## a-index

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

David has been developing apps. To show off the productivity and impact of David's development, David has come up with a metric which David is calling an a-index.

As David is busy developing the next big app, David has gotten you to write a program to calculate an a-index.

An a-index is calculated as the largest integer $$a$$ such that the developer has developed $$a$$ applications that each have at least $$a$$ users.

Given the number of users on each app that a developer has written, what is the developer's a-index?

#### Input Specification

The first line contains one integer, $$n (1 \leq n \leq 10^{5})$$, the number of applications that a developer has developed.

The next line contains $$n$$ space separated integers $$u_i (0 \leq u_i \leq 10^{9})$$, the number of users for the $$i^{th}$$ app.

#### Output Specification

A single integer $$a$$, the developer's a-index.

1
0

0

1
1

1

3
3 2 3

2

4
9 1 1 1

1