#include <bits/stdc++.h>
int main() {
  int a[1005], n, ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    if (a[i] == i) {
      ans++;
      i++;
    }
  }
  printf("%d", ans);
}
