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