#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int maxn = 500000 + 5;
const int INF = 0x3f3f3f3f;
const int P = 1000000007;
const double PI = acos(-1.0);
template <typename T>
inline T gcd(T& a, T& b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
inline T lcm(T& a, T& b) {
  return a / gcd(a, b) * b;
}
template <typename T>
inline T read(T& x) {
  x = 0;
  int _f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') _f |= (ch == '-'), ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x = _f ? -x : x;
}
int n, a[10005];
int main() {
  read(n);
  for (int i = 1; i <= n; i++) read(a[i]);
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] == i) swap(a[i], a[i + 1]), cnt++;
  }
  if (a[n] == n)
    printf("%d\n", cnt + 1);
  else
    printf("%d\n", cnt);
  return 0;
}
