#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1000000000;
int main() {
  int N;
  cin >> N;
  int info[N];
  for (int i = 0; i < N; i++) cin >> info[i];
  int count = 0;
  for (int i = 0; i < N - 1; i++) {
    if (info[i] == i + 1) {
      swap(info[i], info[i + 1]);
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
