#include <bits/stdc++.h>
int main() {
  int n, tmp, ans = 0;
  scanf("%d\n", &n);
  for (int i = (int)(0); i < (int)(n - 1); i++) {
    scanf("%d", &tmp);
    if (tmp == i + 1) {
      ans++;
      scanf("%d", &tmp);
      i++;
    }
  }
  printf("%d", ans);
}
