import std.conv, std.stdio;
import std.algorithm, std.array, std.range, std.string;
import std.numeric;
void main()
{
    immutable n = readln.chomp.to!int;
    auto a = readln.chomp.split.to!(int[]);
    int i = 1;
    a = a.find(i);
    if (a.empty)
        return (-1).writeln;
    while (!a.empty)
    {
        i += 1;
        a = a.find(i);
    }
    (n-i+1).writeln;
}
