#include <bits/stdc++.h>
using namespace std;
int N;
int a[112345];
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> a[i];
  int cnt = 0;
  for (int i = 2; i <= N; i++) {
    if (a[i - 1] == i - 1) {
      cnt++;
      int tmp = a[i];
      a[i] = a[i - 1];
      a[i - 1] = tmp;
    }
  }
  cout << cnt << endl;
  return 0;
}
