#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == i) {
      cnt++;
      if (i == 1)
        swap(a[i], a[i + 1]);
      else if (a[i - 1] != i)
        swap(a[i - 1], a[i]);
      else if (a[i + 1] != i)
        swap(a[i + 1], a[i]);
    }
  }
  printf("%d\n", cnt);
}
