#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int X = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    X = (X << 3) + (X << 1) + ch - '0', ch = getchar();
  return X * w;
}
int main() {
  int n, ans = 0, i, lst;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    if (i == read()) {
      if (lst == i - 1)
        lst = n + 1;
      else {
        ans++;
        lst = i;
      }
    }
  }
  cout << ans << endl;
}
