void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  
  int n; rd(n);
  auto a=readln.split.to!(int[]);

  foreach(ref e; a) e-=1;
  int c=0;
  foreach(i; 0..n-1){
    if(i==a[i]){
      swap(a[i], a[i+1]);
      c+=1;
    }
  }
  if(a[n-1]==n-1) c+=1;

  writeln(c);

}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}