#include <bits/stdc++.h>
using namespace std;
void swap(int &a, int &b) {
  int temp = b;
  b = a;
  a = temp;
}
int main(int argc, char const *argv[]) {
  int N;
  scanf("%d", &N);
  std::vector<int> P(N);
  std::vector<bool> same(N, false);
  for (size_t i = 0; i < N; i++) {
    std::cin >> P[i];
    if (P[i] == i + 1) {
      same[i] = true;
    }
  }
  int counter = 0;
  for (size_t i = 0; i < N; i++) {
    if (same[i] == true) {
      ++counter;
      if (same[i + 1] == true) {
        swap(P[i], P[i + 1]);
        same[i] = false;
        same[i + 1] = false;
      } else {
        swap(P[i], P[i - 1]);
      }
    }
  }
  printf("%d", counter);
  return 0;
}
