#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e5 + 1;
int n;
int a[Nmax];
int cnt;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  if (a[1] == 1) cnt++, a[2] = 1;
  for (int i = 2; i <= n; ++i) {
    if (a[i] == i && a[i - 1] == i - 1) {
      cnt++;
      continue;
    }
    if (a[i] == i && a[i - 1] != i - 1) {
      cnt++;
      continue;
    }
  }
  cout << cnt;
}
