#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c;
  int s = 0, t = 1;
  while (!isdigit(c = getchar()))
    if (c == '-') t = -1;
  do {
    s = s * 10 + c - '0';
  } while (isdigit(c = getchar()));
  return s * t;
}
inline long long readl() {
  char c;
  long long s = 0;
  int t = 1;
  while (!isdigit(c = getchar()))
    if (c == '-') t = -1;
  do {
    s = s * 10 + c - '0';
  } while (isdigit(c = getchar()));
  return s * t;
}
int a[100010];
int main() {
  int n;
  n = read();
  int k = 0, ans = 0;
  for (int i = 1; i <= n; i++) {
    int c;
    a[i] = read();
  }
  int c = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] == i)
      if (a[i + 1] != i && i + 1 != n + 1) ans++, swap(a[i + 1], a[i]);
    if (a[i + 1] == i + 1 && a[i] != i) ans++, swap(a[i + 1], a[i]);
    if (a[i] == i)
      c++;
    else
      ans += c, c = 0;
  }
  printf("%d\n", ans);
}
