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