#include <bits/stdc++.h>
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std;
int main(void) {
  int n;
  cin >> n;
  std::vector<int> a(n), b(n);
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  int k = 0;
  for (int i = 0; i < (int)(n - 1); i++) {
    if (a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      k++;
    }
  }
  cout << k << endl;
  return 0;
}
