#include <bits/stdc++.h>
using namespace std;
int main() {
  int h;
  cin >> h;
  int a[h];
  int n = 0;
  for (int i = 0; i < h; i++) cin >> a[i];
  for (int i = 0; i < h; i++)
    if (a[i] == i + 1) n++;
  for (int i = 0; i < h; i++)
    if (a[i] == i + 1 && a[i + 1] == i + 2) n--;
  cout << n;
  system("pause");
  return 0;
}
