#include <bits/stdc++.h>
void swap(int *x, int *y) {
  int tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int judge(int n, int *p) {
  int i;
  int flag = 0;
  for (i = 0; i < n; i++) {
    if (i + 1 == p[i]) flag = 1;
  }
  if (flag == 0)
    return 0;
  else
    return 1;
}
int main() {
  int n;
  int i;
  int p[100000];
  int count = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &p[i]);
  }
  while (judge(n, p) != 0) {
    for (i = 0; i < n; i++) {
      if (i + 1 == p[i]) {
        swap(&p[i], &p[i + 1]);
        break;
      }
    }
    count++;
  }
  printf("%d\n", count);
}
