#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
int main() {
  int n;
  cin >> n;
  vi arr(n);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> arr[i];
    --arr[i];
  }
  int ans = 0;
  for (int i = 0; i < (int)(n - 1); ++i) {
    if (arr[i] == i) {
      ++ans;
      ++i;
    }
  }
  if (arr[n - 1] == n - 1) ++ans;
  cout << ans << endl;
  return 0;
}
