#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, p[10001], count = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (long long i = 0; i < n; i++) {
    if (i + 1 == p[i]) {
      swap(p[i], p[i + 1]);
      count++;
    }
  }
  cout << count << endl;
  getchar();
  getchar();
}
