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