#include <iostream>
using namespace std;
int p[100005];
int main(void){
    int N; cin>>N;
    for(int i=0;i<N;i++)cin>>p[i];
    int ans=0;
    for(int i=0;i<N;i++)if(p[i]==i+1){ans++;i++;}
    cout<<ans<<endl;
}