local n = io.read("*n")
local cur = 1
for i = 1, n do
  local a = io.read("*n")
  if a == cur then
    cur = cur + 1
  end
end
local used = cur - 1
if used == 0 then
  print(-1)
else
  print(n - used)
end
