#include<bits/stdc++.h>
using namespace std;

int main(){
  int N; cin >> N;
  vector<bool> sam(N+1, 0);
  for(int i = 0; i < N; i++){
    int a; cin >> a;
    a--;
    if(i == a) sam[i] = 1;
  }
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(sam[i] == 1){
      ans++;
      sam[i+1] = 0;
    }
  }
  cout << ans;
}