#include <iostream>
#define MAX 100001
using namespace std;

int main(){
  int N;
  cin >>N;

  int count[MAX]={};

  for(int i=1;i<=N;i++){
    int k;  cin>>k;
    if(i==k) count[i]++;
  }

  int swap=0;
  for(int i=1;i<=N;i++){
    if(count[i]>0){
      swap++;
      count[i+1]--;
    }
  }
  
  cout<<swap<<endl;
  

}
