#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void swap0(T &a, T &b) {
  T t;
  t = a;
  a = b;
  b = t;
}
int main() {
  int N, cnt;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N - 1; i++) {
    if (i + 1 == A[i]) {
      swap0(A[i], A[i + 1]);
      cnt++;
      i = 0;
    }
  }
  cout << cnt << endl;
}
