function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0].split(" ")[0]);
  tmp = input[1].split(" ");
  p = new Array(n).fill(0);
  for(i=0;i<n;i++){
    p[i]=parseInt(tmp[i]);
  }
  var ans=0;
  for(i=0;i<n;i++){
    if(p[i]==i+1&&i!=n-1){
      var x=p[i];
      p[i]=p[i+1];
      p[i+1]=x;
      ans++;
    }else if(p[i]==i+1){
      ans++;
    }
  }

  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));