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