题目描述
Problem Description
Hanako is looking at a sequence of numbers.
She performs the following operations on the sequence:
- Select several elements that are not adjacent to each other.
- Arrange the selected numbers in the order they appear in the sequence.
- Read the arranged numbers as a decimal number.
Hanako is curious about what the smallest positive integer is that she cannot create with these operations.
For example, given the sequence "3 0 1", the positive integers Hanako can create are $1$, $3$, $31$.
In this case:
- $1$ can be created, but $2$ cannot be created because it does not appear in the sequence.
- Positive integers like "$13$" that ignore the order of appearance in the sequence cannot be created.
- Numbers like "$30$" or "$301$" that use adjacent digits cannot be created.
Please help Hanako find the smallest positive integer that cannot be created.
Input Format
$ n $ $ d_1 $ $ d_2 $ $ d_3 $ ... $ d_n $
- The first line contains the length of the sequence $n\ (1\ \leq\ n\ \leq\ 10000)$.
- The second line contains the sequence ($ d_1 $ $ d_2 $ ... $ d_n $) separated by spaces. $d_i\ (i\ =\ 1\ ,\ ...\ ,\ n\ )$ are digits between $0$ and $9$.
Output Format
Output the smallest positive integer that Hanako cannot create. Be careful not to output extra leading zeros. End the output with a newline.
Sample Input and Output
Sample Input #1
3
3 0 1
Sample Output #1
2
Sample Input #2
12
1 2 1 2 3 4 5 6 7 8 9 0
Sample Output #2
21
Sample Input #3
20
1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 0
Sample Output #3
100
Notes/Hints
None
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
3
3 0 1
样例输出
2