#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod = 1e9 + 7;
int main() {
  int N, p[100000];
  cin >> N;
  for (int i(1); i <= N; i++) {
    cin >> p[i];
  }
  int cnt(0);
  int flag[100001] = {0};
  for (int i(1); i <= N; i++) {
    if (i == p[i]) {
      flag[i] = 1;
    }
  }
  for (int i(1); i <= N; i++) {
    if (flag[i] == 1) {
      if (i != N && flag[i + 1] == 1) {
        i++;
        cnt++;
      } else {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
