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