#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, p, ans = 0;
    cin >> n;
    bool read = true;
    for (int i = 1; i <= n; i++) {
        cin >> p;
        if (!read) { read = true; continue; }
        if (read && i == p) { ans++; read = false; }
    }
    cout << ans << endl;
}
