#include <bits/stdc++.h>
void swap(void *x, void *y, size_t size);
int n;
int dat[100005];
int main() {
  int ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &dat[i]);
  }
  for (int i = 1; i < n; i++) {
    if (dat[i] == i) {
      ans++;
      swap(dat + i, dat + i + 1, sizeof(int));
    }
  }
  printf("%d\n", ans);
  return 0;
}
void swap(void *x, void *y, size_t size) {
  if (x == y) {
    return;
  } else {
    while (size--) {
      *((unsigned char *)x + size) ^= *((unsigned char *)y + size);
      *((unsigned char *)y + size) ^= *((unsigned char *)x + size);
      *((unsigned char *)x + size) ^= *((unsigned char *)y + size);
    }
  }
}
