#include <bits/stdc++.h>
constexpr long long INF = 1000000000;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> p(n);
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> p[i];
  for (int i = 0; i < (n); i++) a[i] = i + 1;
  vector<int> t(n);
  for (int i = 0; i < (n); i++) {
    if (p[i] == a[i])
      t[i] = 1;
    else
      t[i] = 0;
  }
  int count = 0;
  for (int i = 0; i < (n - 1); i++) {
    if (t[i] == 1 && t[i + 1] == 1) {
      t[i] = 0;
      t[i + 1] = 0;
      count++;
    } else if (t[i] == 1 && t[i + 1] == 0) {
      t[i] = 0;
      count++;
    }
  }
  cout << count << endl;
}
