#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int roop, stk;
  vector<int> number;
  cin >> roop;
  for (int i = 0; i < roop; i++) {
    cin >> stk;
    number.push_back(stk);
  }
  int swap_count = 0;
  if (number[0] == 1) {
    swap(number[0], number[1]);
    swap_count++;
  }
  if (number[roop - 1] == roop) {
    swap(number[roop - 1], number[roop - 2]);
    swap_count++;
  }
  for (int i = 1; i < roop - 1; i++) {
    if (number[i] == i + 1) {
      cout << "a";
      if (number[i - 1] != i + 1) {
        swap(number[i], number[i - 1]);
      } else {
        swap(number[i], number[i + 1]);
      }
      swap_count++;
    }
  }
  if (number[roop - 1] == roop) {
    swap_count = 0;
    if (number[0] == 1) {
      swap(number[0], number[1]);
      swap_count++;
    }
    if (number[roop - 1] == roop) {
      swap(number[roop - 1], number[roop - 2]);
      swap_count++;
    }
    for (int i = roop - 1; i > 0; i--) {
      if (number[i] == i + 1) {
        if (number[i + 1] != i + 1) {
          swap(number[i], number[i + 1]);
        } else {
          swap(number[i], number[i - 1]);
        }
        swap_count++;
      }
    }
  }
  cout << swap_count << endl;
}
