#include <iostream>
#include <vector>
using namespace std;

int main(void){
  int n;
  cin >> n;
  int p[n];
  for(int i = 0; i < n; i++) cin >> p[i];
  int ans = 0;
  int i = 0;
  while(i < n){
    if(p[i] == i + 1){
      ans++;
      i += 2;
    }else{
      i++;
    }
  }
  cout << ans << endl;
  return 0;
}
