#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> p(100001, 0);
int main(void) {
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) scanf("%d", &p[i]);
  int ans = 0, sum = 0;
  for (int i = 0; i < N; ++i) {
    if (p[i] == i + 1)
      ++sum;
    else {
      if (sum) ans += (sum == 1) ? sum : sum - 1;
      sum = 0;
    }
  }
  if (sum) ans += (sum == 1) ? sum : sum - 1;
  printf("%d\n", ans);
  return 0;
}
