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

#define rep(i, n) for (int i = 0; i < (n); i++)

int main(){
    int N;  
    cin >> N;
    int P[N];
    rep(i,N) cin >> P[i];

    int count = 0;
    rep(i,N){
        if(P[i]==i+1){
            count++;
            i++;
        }
    }
    cout << count;

    return 0;
}