#include <bits/stdc++.h>
using namespace std;
const int IINF = 1e9;
const long long LINF = 1e18;
const long long mod = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> p[i];
    p[i]--;
  }
  int counter = 0;
  for (int i = 0; i < (int)(N - 1); i++) {
    if (p[i] == i) {
      swap(p[i], p[i + 1]);
      counter++;
    }
  }
  cout << counter << endl;
  return 0;
}
