#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,j=0,k=0;
  cin>>N;
  for(int i=1;i<=N;i++){
    int p;
    cin>>p;
    if(i==p)
      k++;
    else if(k>0){
      j+=(k+1)/2;
      k=0;
    }
  }
  j+=(k+1)/2;
  cout<<j<<endl;
}