#include <bits/stdc++.h>
using namespace std;
inline long long rrr() {
  long long x, f = 1;
  char a;
  while ((a = getchar()) < 48 || a > 57)
    if (a == 45) f = -1;
  for (x = a ^ 48; (a = getchar()) > 47 && a < 58;
       x = (x << 3) + (x << 1) + (a ^ 48))
    ;
  return f * x;
}
struct nnn {
  int x, y, z;
};
void Main();
int a[100005];
void Main() {
  int n;
  cin >> n;
  for (int i = 1, ie = n; i <= ie; ++i) a[i] = rrr();
  int ans = 0;
  for (int i = 2, ie = n; i <= ie; ++i) {
    if (a[i] == i) swap(a[i], a[i - 1]), ++ans;
  }
  if (a[1] == 1) ++ans;
  cout << ans;
}
int main() {
  Main();
  return 0;
}
