#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  cin.ignore();
  string str;
  getline(cin, str);
  stringstream ss(str);
  vector<int> a_vec;
  for (int i; !ss.eof();) {
    ss >> i;
    a_vec.push_back(i);
  }
  int ans = 0;
  for (size_t index = 0; index < (N - 1); index++) {
    if (a_vec[index] == index + 1 && a_vec[index + 1] == index + 2) {
      ans++;
      index++;
    } else if (a_vec[index] == index + 1) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
