#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<bool> flag(N, false);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a == i + 1) {
      flag[a] = true;
    }
  }
  int cnt = 0;
  for (int start = 0; start < N; start++) {
    if (!(flag[start])) {
      continue;
    }
    int search = start;
    while (search < N && search - start < 2 && flag[search]) {
      flag[search] = false;
      search++;
    }
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}
