#include <bits/stdc++.h>
template <class T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
int main(void) {
  int n;
  cin >> n;
  vi p(n);
  for (int(i) = 0; (i) < (n); (i)++) cin >> p[i];
  for (int(i) = 0; (i) < (n); (i)++) p[i]--;
  int ans = 0;
  for (int(i) = 0; (i) < (n - 1); (i)++) {
    if (p[i] == i) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
