Module kkk
  Sub Main()
    
    Dim N As long
    Dim a
    Dim i As long
    Dim cnt As long
    
    N = Console.ReadLine()
    a = Console.ReadLine()
    a = split(a, " ")
    
    For i = 0 to N - 1
    If a(i) = cnt + 1 Then
      cnt = cnt + 1
    End if
  	Next
    
  If cnt = 0 Then
      console.writeline(-1)
  Else 
      console.writeline(N - cnt)
  End If
    
End Sub
End Module