#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int a[100000];
  int x = 0;
  int ans = 0;
  int i, j, k;
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (i = 0; i < N - 1; i++) {
    if (a[i] == i + 1) {
      x = a[i];
      a[i] = a[i + 1];
      a[i + 1] = x;
      ans = ans + 1;
    }
  }
  cout << ans;
  return 0;
}
