#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmin(T& a, T const& b) {
  if (b < a) a = b;
}
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
using ll = long long;
const ll mod = LLONG_MAX;
int p[112345];
int ans;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) {
    if (i + 2 < n && i + 1 == p[i] && i + 2 == p[i + 1]) {
      ans++;
      i++;
    } else if (i + 1 == p[i])
      ans++;
  }
  cout << ans << endl;
}
