{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003ch2\u003eProblem A\n\u003c/h2\u003e\n\n\u003cp\u003e\nHanako learned the conjecture that all the non-negative integers appear in the infinite digit sequence of the decimal representation of $\\pi$ \u003d 3.14159265..., the ratio of a circle\u0027s circumference to its diameter. After that, whenever she watches a sequence of digits, she tries to count up non-negative integers whose decimal representations appear as its subsequences.\n\u003c/p\u003e\n\n\u003cp\u003e\nFor example, given a sequence \"\u003cspan\u003e3 0 1\u003c/span\u003e\", she finds representations of five non-negative integers 3, 0, 1, 30 and 301 that appear as its subsequences.\n\u003c/p\u003e\n\n\u003cp\u003e\nYour job is to write a program that, given a finite sequence of digits, outputs the smallest non-negative integer not appearing in the sequence. In the above example, 0 and 1 appear, but 2 does not. So, 2 should be the answer.\n\u003c/p\u003e\n\n\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cp\u003e\nThe input consists of a single test case.\u003cbr\u003e\n\u003cbr\u003e\n\n$n$\u003cbr\u003e\n$d_1$ $d_2$ ... $d_n$\u003cbr\u003e\n\u003cbr\u003e\n\n$n$ is a positive integer that indicates the number of digits. Each of $d_k$\u0027s $(k \u003d 1, ... , n)$ is a digit. There is a space or a newline between $d_k$ and $d_{k+1}$ $(k \u003d 1, ..., n - 1)$.\n\u003c/p\u003e\n\n\u003cp\u003e\nYou can assume that $1 \\leq n \\leq 1000$.\n\u003c/p\u003e\n\n\n\u003ch3\u003eOutput\u003c/h3\u003e\n\n\u003cp\u003e\nPrint the smallest non-negative integer not appearing in the sequence.\n\u003c/p\u003e\n\n\n\u003ch3\u003eSample Input 1\u003c/h3\u003e\n\n\u003cpre\u003e3\n3 0 1\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 1\u003c/h3\u003e\n\n\u003cpre\u003e2\u003c/pre\u003e\n\n\n\n\u003ch3\u003eSample Input 2\u003c/h3\u003e\n\n\u003cpre\u003e11\n9 8 7 6 5 4 3 2 1 1 0\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 2\u003c/h3\u003e\n\n\u003cpre\u003e12\u003c/pre\u003e\n\n\n\n\u003ch3\u003eSample Input 3\u003c/h3\u003e\n\n\u003cpre\u003e10\n9 0 8 7 6 5 4 3 2 1\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 3\u003c/h3\u003e\n\n\u003cpre\u003e10\u003c/pre\u003e\n\n\n\u003ch3\u003eSample Input 4\u003c/h3\u003e\n\n\u003cpre\u003e100\n3 6 7 5 3 5 6 2 9 1 2 7 0 9 3 6 0 6 2\n6 1 8 7 9 2 0 2 3 7 5 9 2 2 8 9 7 3 6\n1 2 9 3 1 9 4 7 8 4 5 0 3 6 1 0 6 3 2\n0 6 1 5 5 4 7 6 5 6 9 3 7 4 5 2 5 4 7\n4 4 3 0 7 8 6 8 8 4 3 1 4 9 2 0 6 8 9\n2 6 6 4 9\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 4\u003c/h3\u003e\n\n\u003cpre\u003e11\u003c/pre\u003e\n\n\n\u003ch3\u003eSample Input 5\u003c/h3\u003e\n\n\u003cpre\u003e100\n7 2 7 5 4 7 4 4 5 8 1 5 7 7 0 5 6 2 0\n4 3 4 1 1 0 6 1 6 6 2 1 7 9 2 4 6 9 3\n6 2 8 0 5 9 7 6 3 1 4 9 1 9 1 2 6 4 2\n9 7 8 3 9 5 5 2 3 3 8 4 0 6 8 2 5 5 0\n6 7 1 8 5 1 4 8 1 3 7 3 3 5 3 0 6 0 6\n5 3 2 2 2\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 5\u003c/h3\u003e\n\n\u003cpre\u003e86\u003c/pre\u003e\n\n\n\u003ch3\u003eSample Input 6\u003c/h3\u003e\n\n\u003cpre\u003e1\n3\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 6\u003c/h3\u003e\n\n\u003cpre\u003e0\u003c/pre\u003e\n\n"}}]}