#include #include using namespace std; int main() { int N; vector a; cin >> N; int res = N; for (int i = 0, x, left; i < N; ++i) { cin >> x; a.push_back(x); if (i == 0) left = x; else if (x == left + 1) ++left, --res; else left = x, res = N; } cout << res << endl; return 0; }