#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
int p[100001];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  int ans = 0;
  for (int i = 1; i < n; i++)
    if (p[i] == i && p[i + 1] == i + 1) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  for (int i = 1; i < n; i++)
    if (p[i] == i) ans++;
  printf("%d", ans);
  return 0;
}
