#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int N, count = 0;
  cin >> N;
  const int n = N;
  int p[n];
  for (size_t i = 0; i < n; i++) {
    std::cin >> p[i];
  }
  for (size_t i = 0; i < n; i++) {
    if (p[i] == i + 1) {
      if (p[i - 1] == i) {
        swap(p[i], p[i - 1]);
        count++;
      } else {
        swap(p[i], p[i + 1]);
        count++;
      }
    }
  }
  cout << count;
  return 0;
}
