//PascalABC.Net 3.1.0.1200
var
f: TextFile;
begin
if not FileExists('input.txt') then Exit;
Reset(f, 'input.txt');
var n := ReadlnInteger(f);
var a := ArrFill(n + 1, 0);
for var i := 1 to n do
a[i - 1] := ReadInteger(f);
a[n] := n + 2;
println(a);
a.Sort;
println(a);
for var i := 1 to n + 1 do
if a[i - 1] <> i then begin
writeln(i);
break;
end;
end.