#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)

int main(){
  int n;
  cin >> n;
  int p[n];
  rep(i, n) cin >> p[i];
  int ans = 0;
  rep(i, n-1){
    if(p[i] == i+1) {
      swap(p[i], p[i+1]);
      ans++;
    }
  }
  if(p[n-1] == n) ans++;
  cout << ans << endl;
  return 0;
}
