#include<bits/stdc++.h>
using namespace std;

signed main() 
{
	int n , x , count = 1; cin >> n;
	for(int i = 0 ; i < n && cin >> x; ++i) if(x == count) count++;
	cout << ((count==1)?-1:n-count+1) << endl;
} 
