#include <bits/stdc++.h>
int main() {
  int N;
  int a[100000];
  scanf("%d", &N);
  int i, j;
  for (i = 0; i < N; i++) scanf("%d", &a[i]);
  int count = 0;
  int tmp;
  int x;
  for (i = 0; i < N; i++) {
    if (i != 0 && a[i] == i + 1 && a[i - 1] != i + 1) {
      tmp = a[i];
      a[i] = a[i - 1];
      a[i - 1] = tmp;
      count++;
    } else if (i != N - 1 && a[i] == i + 1 && a[i + 1] != i + 1) {
      tmp = a[i];
      a[i] = a[i + 1];
      a[i + 1] = tmp;
      count++;
    } else {
      x = 0;
      while (i - x >= 0 && i + x < N && a[i + x] == i + x + 1 &&
             a[i - x] == i - x + 1)
        x++;
      if (i - x < 0) {
        while (i + x < N && a[i + x] == i + x + 1) x++;
        for (j = 0; j < x; j++) {
          tmp = a[i + j];
          a[i + j] = a[i + j + 1];
          a[i + j + 1] = tmp;
        }
        count++;
      } else {
        while (i - x >= 0 && a[i - x] == i - x + 1) x++;
        for (j = 0; j < x; j++) {
          tmp = a[i - j];
          a[i - j] = a[i - j - 1];
          a[i - j - 1] = tmp;
        }
        count++;
      }
    }
  }
  printf("%d", count);
  return 0;
}
