#include<iostream>
using namespace std;

int main(){
    int N;
    int p[100001]={};
    int i;
    int count = 0;
    
    cin >> N;
    for(i=1;i<N+1;i++)
        cin >> p[i];
    
    for(i=1;i<N+1;i++){
        if(i == p[i]){
            count++;
            i++;
        }
    }
    cout << count << endl;
    return 0;
}