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