#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};
int main() {
  int n;
  cin >> n;
  vi p(n);
  for (int i = 0, i_len = (n); i < i_len; ++i) cin >> p[i];
  int ans = 0;
  for (int i = 0, i_len = (n - 1); i < i_len; ++i)
    if (i + 1 == p[i]) {
      ans++;
      i++;
    }
  cout << ans << endl;
}
