#include<bits/stdc++.h>
#define MAX 100005
using namespace std;
 
int main(){
  int n, a, ans = 0, cnt = 1;
  scanf("%d", &n);
  for(int i = 1; i <= n; i++){
    scanf("%d", &a);
    if(a != i){
      ans += cnt/2;
      cnt = 1;
    }else cnt++;
  }
  ans += cnt/2;
  printf("%d\n", ans);
}
