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