#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int N, a[100101] = {};
    cin >> N;
    int cnt = 0;
    for(int i = 0; i < N; ++i){
        int in;
        cin >> in; in--;
        if(i == in){
            cnt++, i++;
            cin >> in;
        }
    }
    cout << cnt << endl;
}
