eolymp
bolt
Try our new interface for solving problems
Məsələlər

Перестановка

Перестановка

The sequence of \textbf{n} positive integers is given. Determines whether the sequence is a permutation of the first \textbf{n} natural numbers. \InputFile One line specifies the number \textbf{n} (\textbf{n }≤ \textbf{10000}) and \textbf{n} positive integers separated by space. It is known that each positive integer is less than \textbf{2000000.} \OutputFile Print \textbf{0}, if the sequence is a permutation. Otherwise print the minimum number that is not in the sequence.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 128 MiB
Giriş verilənləri #1
3 2 1 3 
Çıxış verilənləri #1
0
Giriş verilənləri #2
3 1 4 2 
Çıxış verilənləri #2
3
Mənbə II этап Всеукраинской олимпиады школьников 2008-2009, г. Бердичев