#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i < n; i++) {
    cin >> a[i];
  }
  int num = 0;
  if (a[1] == 1) {
    int t = a[1];
    a[1] = a[2];
    a[2] = t;
    num++;
  }
  for (int i = 2; i < n + 1; i++) {
    if (a[i] == i) {
      int t = a[i];
      a[i] = a[i - 1];
      a[i - 1] = t;
      num++;
    }
  }
  cout << num << endl;
}
