#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i = 0; i < n; ++i) cin >> v[i];
  int ans = 0;
  for(int i = 0; i < n; ++i){
    if(v[i] == i + 1){
      ans++;
      if(i + 1 == n) swap(v[i], v[i - 1]);
      else swap(v[i], v[i+1]);
    }
  }
  cout << ans << endl;
}