#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int inp[n + 1];
  for (int i = 1; i <= n; i++) scanf("%d", &inp[i]);
  int cnt = 0;
  for (int i = 1; i <= n - 1; i++) {
    if (inp[i] == i) {
      swap(inp[i], inp[i + 1]);
      cnt++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
