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

int main() {
    int N;
    cin >> N;
    vector<int>p(N);swap
    for(int i = 0; i < N; i++) {
        cin >> p[i];
    }
    int ans;
    if(p[0] == 1) {
        swap(p[0],p[1]);
        ans++;
    }
    for(int i = 1; i < N; i++) {
        if(p[i] == i+1) {
            swap(p[i],p[i-1]);
            ans++;
        }
    }
    cout << ans << endl;
}