#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  int i;
  for (i = 1; i <= n; i++) cin >> a[i];
  int ans = 0;
  for (i = 1; i <= n - 1; i++) {
    if (a[i] == i && a[i + 1] == i + 1) {
      ans++;
      i++;
      swap(a[i], a[i + 1]);
    } else if (a[i] == i) {
      ans++;
      swap(a[i], a[i + 1]);
    }
  }
  int f = 1;
  if (a[n] == n && a[n - 1] == n - 1) f = 0;
  if (a[n] == n && f == 1) ans++;
  cout << ans;
}
