#include <bits/stdc++.h>
using namespace std;
int n, p[100010], i, ans, t;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &p[i]);
  ans = 0;
  for (i = 1; i < n; i++) {
    if (p[i] != i)
      continue;
    else {
      t = p[i];
      p[i] = p[i + 1];
      p[i + 1] = t;
      ans++;
    }
  }
  printf("%d\n", ans);
}
