#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
  int N,a,counter=0;
  cin>>N;
  int a[100000];
  for (int i=1; i<=N; i++){
  cin>>a[i];}
  for (int i=1; i<=N; i++){
  if(a[i]==i){
  counter++;
  a[i+1]=i;}}
  cout<<counter<<endl;}
  
