#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p;
  int cnt = 0;
  int total = 0;
  for (int i = 0; i < (int)(n); i++) {
    cin >> p;
    if (p == i + 1) {
      cnt++;
    } else {
      total += (cnt + 1) / 2;
      cnt = 0;
    }
  }
  cout << total;
}
