#include <bits/stdc++.h>
using namespace std;
const int len = 100010;
int n, a[len];
int main() {
  ios ::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int sum = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      sum++;
    }
  }
  cout << sum << endl;
  return 0;
}
