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