#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main(int argc, char const* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) cin >> p[i];
  ull count = 0;
  for (int i = 0; i < N - 1; i++) {
    if (i == N - 2) {
      if (p[i + 1] == i + 2) {
        int c = p[i];
        p[i] = p[i + 1];
        p[i + 1] = c;
        count++;
      }
    } else if (p[i] == i + 1) {
      int c = p[i];
      p[i] = p[i + 1];
      p[i + 1] = c;
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
