#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 5, oo = 2e9 + 1;
int n, m, q, k, a[N], fr[N];
vector<vector<int> > g;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  int res = 0;
  for (int i = 1; i < n; ++i) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      --i;
      ++res;
    }
  }
  printf("%d\n", res);
  return 0;
}
