#include <bits/stdc++.h>
int main() {
  int n, a[100001], i, j, c = 0, t;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (a[j] == j) {
        if (a[j + 1] != j) {
          t = a[j];
          a[j] = a[j + 1];
          a[j + 1] = t;
          c++;
        } else if (a[j - 1] != j) {
          t = a[j];
          a[j] = a[j - 1];
          a[j - 1] = t;
          c++;
        }
      }
    }
  }
  printf("%d\n", c);
  return 0;
}
