#include <bits/stdc++.h>

using namespace std;

int main()
{
  int n;
  scanf("%d", &n);
  
  int ans = 0;
  int tmp = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    
    if (a == i) {
      tmp++;
    }
    else {
      ans += (tmp + 1) / 2;
      tmp = 0;
    }
  }
  printf("%d\n", ans + (tmp + 1) / 2;
  return 0;
}