#include <bits/stdc++.h>
using namespace std;
int n;
int ans;
int ii;
int a[100050];
int read() {
  int s = 0, t = 1;
  char ch;
  while (ch < '0' || ch > '9') {
    if (ch == '-') t = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * t;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  ii = 1;
  while (ii <= n) {
    if (a[ii] == ii && a[ii + 1] == ii + 1) {
      ans++;
      ii += 2;
    }
    if (a[ii] == ii && a[ii + 1] != ii + 1) ans++;
    ii++;
  }
  printf("%d", ans);
}
