AT_abc409_b [ABC409B] Citation

Description

You are given a sequence of non-negative integers $ A=(A_1,A_2,\dots,A_N) $ of length $ N $ . Find the maximum non-negative integer $ x $ that satisfies the following: - In $ A $ , elements greater than or equal to $ x $ appear at least $ x $ times (including duplicates).

Input Format

The input is given from Standard Input in the following format: > $ N $ $ A_1 $ $ A_2 $ $ \dots $ $ A_N $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 In $ A=(1,2,1) $ : - Elements greater than or equal to $ 0 $ appear $ 3 $ times. - Elements greater than or equal to $ 1 $ appear $ 3 $ times. - Elements greater than or equal to $ 2 $ appear $ 1 $ time. - Elements greater than or equal to $ 3 $ appear $ 0 $ times. The maximum non-negative integer that satisfies the condition is $ 1 $ . ### Constraints - $ 1 \leq N \leq 100 $ - $ 0 \leq A_i \leq 10^9 $ - All input values are integers.