#include<bits/stdc++.h>
using namespace std;


int main(){
  int n,ans,i;
  cin >> n;
  int sw;
  vector<int> p(n);
  for(i=0;i<n;++i){
    cin >> p[i];
  }
  ans=0;
  for(i=0;i<n;++i){
    if(p[i]==(i+1)){
      sw=p[i];
      p[i]=p[i+1];
      p[i+1]=sw;
      ans++;
    }
  }
  cout << ans << endl;
}
