#include <bits/stdc++.h>
using namespace std;
int s[100005] = {0};
int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n; i++) {
    if (s[i] == i) {
      swap(s[i], s[i + 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
  system("pause");
  return 0;
}
