#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p[100010];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i];
  bool f[100010] = {};
  for (int i = 0; i < n; i++) {
    if (p[i] == i + 1) f[i + 1] = true;
  }
  int cnt = 0, ans = 0;
  for (int i = 0; i < 100005; i++) {
    if (f[i])
      cnt++;
    else {
      if (cnt > 1)
        ans += cnt - 1;
      else if (cnt)
        ans++;
      cnt = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
