#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long LINF = 1e18;
int main() {
  int n;
  cin >> n;
  vector<int> p(n + 1);
  for (int i = 0; i < (int)(n); i++) cin >> p[i + 1];
  int counter = 0;
  for (int i = 1; i < n; i++) {
    if (i == p[i]) {
      swap(p[i], p[i + 1]);
      counter++;
    }
  }
  cout << counter << endl;
}
