#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int p[N + 1];
  for (int i = 1; i <= N; i++) {
    cin >> p[i];
  }
  int sum = 0;
  bool f;
  for (int i = 1; i <= N; i++) {
    if (p[i] == i) {
      sum++;
      f = false;
      while (i < N && p[i + 1] == i + 1) {
        sum++;
        i++;
        f = true;
      }
      if (f) {
        sum--;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
