#include<bits/stdc++.h>
using namespace std;
int N,p,f,ans;
int main(){
    cin>>N;
    for(int i{1};i<=N;++i){
        cin>>p;
        if(p==i&&!f)++ans,f=1;
        else f=0;
    }
    cout<<ans<<endl;
}
