#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[100001], tmp, N, cnt = 0;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> arr[i];
  for (int i = 0; i < N; i++) {
    if (arr[i] == i + 1) {
      if (i == 0) {
        tmp = arr[i];
        arr[i] = arr[i + 1];
        arr[i + 1] = tmp;
        cnt++;
      } else {
        tmp = arr[i];
        arr[i] = arr[i - 1];
        arr[i - 1] = tmp;
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
