#include #include #include #include #include #include #include #include #include using namespace std; #define ll long long int #define tlll tuple #define pii pair tlll params[200]; int main() { int n; cin >> n; vector vs(n); for(int i = 0;i < n;i++) { cin >> vs[i]; } int current = n + 1; int remove = 0; for(int i = n-1;i >= 0;i--) { if(vs[i] == current -1) { current = vs[i]; remove++; } } cout << n - remove << endl; return 0; }