#include <bits/stdc++.h>
using namespace std;
int n, m, r;
int p[114514];
int main(void) {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    p[i] = temp - 1;
  }
  int cnt = 0;
  bool check[n];
  for (int i = 0; i < n; i++) {
    if (p[i] == i)
      check[i] = false;
    else
      check[i] = true;
  }
  for (int i = 0; i < n - 1; i++) {
    if (!check[i]) {
      check[i] = true;
      check[i + 1] = true;
      cnt++;
    }
  }
  cout << cnt << endl;
}
