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