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

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