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

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    for (int i = 0; i < N; i++) cin >> P[i];

    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (P[i] == i + 1) {
            ans++;
            i++;
        }
    }
    cout << ans << endl;
}