#include <bits/stdc++.h>
using namespace std;
const int M = 100010;
int x, cnt, ans, p, k, t, l, n;
int a[M], b[M];
bool f[M];
char s[M];
int main() {
  memset(f, 0, sizeof(f));
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  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) {
      if (a[i - 1] != i && i - 1 != 0) {
        swap(a[i], a[i - 1]);
        ans++;
      } else if (a[i + 1] != i && i + 1 != n + 1) {
        swap(a[i], a[i + 1]);
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
