#include <bits/stdc++.h>
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  vector<bool> change(n, false);
  for (ll i = 0; i < n; i++) {
    int p;
    cin >> p;
    if (p == i + 1) change[i] = true;
  }
  int cnt = 0;
  for (ll i = 0; i < n - 1; i++) {
    if (change[i]) {
      cnt++;
      change[i + 1] = false;
    }
  }
  cout << cnt;
  cout << "\n";
  return 0;
}
