#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int p[N] = {0};
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int k;
    cin >> k;
    p[i] = k - i;
  }
  int cnt = 0;
  for (int i = 1; i <= n - 1; i++) {
    if (p[i] == 0) {
      if (p[i + 1] != -1) {
        p[i]--;
        p[i + 1]++;
        int tmp = p[i];
        p[i] = p[i + 1];
        p[i + 1] = tmp;
        cnt++;
        continue;
      }
      if (p[i] != 1) {
        p[i]++;
        p[i - 1]--;
        cnt++;
        int tmp = p[i];
        p[i] = p[i + 1];
        p[i + 1] = tmp;
        continue;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
