Define $$$mex(b)$$$ as the minimum non-negative integer that doesn't appear in the array $$$b$$$. For example, $$$mex([1, 0, 2]) = 3$$$ and $$$mex([1]) = 0$$$.
Given an array $$$a$$$ of length $$$n$$$. You can do the following operation at most once:
What is the maximum value of $$$mex(a)$$$ after performing the above operation at most once.
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^6$$$) — the size of the array.
The second line of the input consists of $$$n$$$ space-separated integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le n$$$).
Output a single integer — the maximum possible value of $$$mex(a)$$$.
41 2 3 0
4
22 1
2
| Name |
|---|


