#include <bits/stdc++.h>
void swap(int &a, int &b) {
  int c;
  c = a;
  a = b;
  b = c;
}
int main() {
  int n;
  int sum = 0;
  int arr[100100];
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
  for (int j = 1; j < n; j++)
    if (arr[j] == j || arr[j + 1] == j + 1) {
      swap(arr[j], arr[j + 1]);
      sum++;
    }
  printf("%d\n", sum);
  return 0;
}
