Ants
Charles is fascinated by ants. In order to observe a colony of ants over a long period of time, Charles managed to build a program that uniquely identifies each ant using image recognition. (Yes, every ant is unique.) Inside the program, each ant is tagged with a unique nonnegative integer. Whenever there is a birth in the colony, the new ant is given a new tag that is different from all the tags already assigned. Whenever an ant disappears, its tag falls back into the pool of available tags.
Charles’s program works as follows. It first scans the whole colony, building a list of the tags of the ants that are recognized. Then it assigns fresh tags to the new ants. To do so, the program simply picks the first natural number (i.e., nonnegative integer) that is not currently assigned to any ant, and so on.
Due to some glitches in the image recognition device and in the program, there are sometimes negative or very large numbers that appear in the input list. These are simply ignored by Charles’s program.
Your job is to reimplement the part of Charles’s program that finds a fresh tag to assign to a new ant.
Input
The first line contains one integer .
The next lines contains integers , one per line. Each integer has less than digits.
Output
Print the smallest nonnegative integer that does not belong to the set .