#include <bits/stdc++.h>
const int INF = 1 << 29;
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) {
    cin >> P[i];
  }
  int count = 0;
  for (int i = 0; i < N - 1; i++) {
    if (P[i] == i + 1) {
      count++;
    }
    if (P[i] == i + 1 && P[i + 1] == i + 2) {
      count--;
    }
  }
  if (P[N - 1] == N) {
    count++;
  }
  cout << count << endl;
}
