27A.md (1121B)
1 Source: https://codeforces.com/problemset/problem/27/A 2 3 A. Next Test 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 «Polygon» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the next test will have, the system suggests the default value of the index. It is calculated as the smallest positive integer which is not used as an index for some previously added test. 22 23 You are to implement this feature. Create a program which determines the default index of the next test, given the indexes of the previously added tests. 24 25 Input 26 27 The first line contains one integer *n* (1 ≤ *n* ≤ 3000) — the amount of previously added tests. The second line contains *n* distinct integers *a*1, *a*2, ..., *a**n* (1 ≤ *a**i* ≤ 3000) — indexes of these tests. 28 29 Output 30 31 Output the required default value for the next test index. 32 33 Examples 34 35 Input 36 37 ``` 38 3 39 1 7 2 40 ``` 41 42 Output 43 44 ``` 45 3 46 ```