#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n;
int li[N + 5];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &li[i]);
  }
  int id = 1;
  int ans = 0;
  while (id <= n) {
    if (id != li[id]) {
      id++;
      continue;
    }
    ans++;
    if (id + 1 < n && id + 1 == li[id + 1])
      id += 2;
    else
      id++;
  }
  printf("%d\n", ans);
  return 0;
}
