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

int main(){
  int N;
  cin >> N;
  vector<int> p(100009);
  for(int i=1;i<=N;i++)cin >> p[i];
  int count=0;
  for(int i=1;i<=N;i++){
    if(p[i]==i){
      count++;
      if(i<=N-1 && p[i+1]==i+1){i++;}
    }
  }
  cout << count << endl;
}