e-olymp
Problems

Permutation

Permutation

The sequence of n positive integers is given. Determines whether the sequence is a permutation of the first n natural numbers.

Input

One line specifies the number n (n10000) and n positive integers separated by space. It is known that each positive integer is less than 2000000.

Output

Print 0, if the sequence is a permutation. Otherwise print the minimum number that is not in the sequence.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 2 1 3 
Output example #1
0
Input example #2
3 1 4 2 
Output example #2
3
Source II этап Всеукраинской олимпиады школьников 2008-2009, г. Бердичев