#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
bool check(int n) {
  for (int i = 1; i <= n; i++)
    if (a[i] == i) return false;
  return true;
}
int main() {
  int n;
  cin >> n;
  int d = 0;
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    if (a[i] == i) d++;
  }
  int res = 0;
  while (!check(n)) {
    for (int i = 1; i <= n; i++) {
      if (a[i] == i) {
        if (a[i + 1] != a[i] && i + 1 <= n) {
          swap(a[i], a[i + 1]);
          res++;
        } else if (a[i - 1] != a[i] && i - 1 > 0) {
          swap(a[i], a[i - 1]);
          res++;
        }
      }
    }
  }
  cout << res;
  return 0;
}
