#include <bits/stdc++.h>
using namespace std;
int A[(int)1e5];
int N;
bool isValid() {
  for (int i = 0; i < N; i++) {
    if (A[i] == i + 1) return false;
  }
  return true;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  int swaps = 0;
  while (!isValid()) {
    for (int i = 1; i < N - 1; i++) {
      if (A[i - 1] == i) {
        swaps++;
        swap(A[i - 1], A[i]);
      }
    }
    if (A[N - 1] == N) {
      swaps++;
      swap(A[N - 1], A[N - 2]);
    }
  }
  cout << swaps << "\n";
}
