#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, p;
  cin >> n;
  std::deque<int> deq;
  for (int i = 0; i < n; i++) {
    cin >> p;
    deq.emplace_back(p);
  }
  int count = 0;
  int flag = 1;
  while (flag == 1) {
    for (int j = 0; j < n - 1; j++) {
      if (deq[j] == j + 1 || deq[j + 1] == j + 2) {
        swap(deq[j], deq[j + 1]);
        count++;
        if (deq[j] == j + 1 || deq[j + 1] == j + 2) {
          flag = 1;
        } else {
          flag = 0;
        }
      }
    }
  }
  cout << count << endl;
}
