#include <bits/stdc++.h>
using namespace std;
template <class T>
void gc(T &x) {
  char c;
  int s = 0;
  x = 0;
  c = getchar_unlocked();
  if (c == '-')
    s = 1;
  else if ('0' <= c && c <= '9')
    x = c - '0';
  while (true) {
    c = getchar_unlocked();
    if (c < '0' || c > '9') break;
    x = x * 10 + (c - '0');
  }
  if (s) x = -x;
}
int main() {
  int N;
  gc(N);
  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    int tmp;
    gc(tmp);
    P[i] = tmp;
  }
  int cnt = 0;
  for (int i = 0; i < N - 1; i++) {
    if (P[i] == i + 1) {
      swap(P[i], P[i + 1]);
      cnt++;
    } else if (P[i + 1] == i + 2) {
      swap(P[i], P[i + 1]);
      cnt++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
