#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  vector<bool> b(n + 1, false);
  for (int i = 0; i < (n); ++i) cin >> a[i + 1];
  for (int i = 1; i <= n; ++i) {
    if (i == a[i]) b[i] = true;
  }
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    if (b[i] && b[i + 1]) {
      ans++;
      b[i] = false;
      b[i + 1] = false;
    } else if (b[i]) {
      ans++;
      b[i] = false;
    }
  }
  cout << ans << endl;
}
