#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main() {
  ll N;
  cin >> N;
  vector<bool> vecp(N, false);
  for (int i = 0; i < (N); i++) {
    ll p;
    cin >> p;
    if (p == i + 1) {
      vecp.at(i) = true;
    }
  }
  ll count = 0;
  for (int i = 0; i < (N - 1); i++) {
    if (vecp.at(i)) {
      count++;
      i++;
    }
  }
  cout << count << endl;
  return 0;
}
