#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int n,i,p[100010],ans=0;
  cin >> n;
  for (i=0;i<n;i++) cin >> p[i];
  for (i=0;i<n-1;i++) if (p[i]==i+1){
    swap(p[i],p[i+1]);
    ans++;
  }
  if (p[n-1]==n) ans++;
  cout << ans << endl;
  return 0;
}