#include <bits/stdc++.h>
using namespace std;
vector<int> input(int N) {
  int i;
  vector<int> output(N);
  for (i = 0; i < N; i++) cin >> output[i];
  return output;
}
int main() {
  int i;
  int N;
  int same_streak = 0;
  int result = 0;
  vector<int> P;
  cin >> N;
  P = input(N);
  vector<int> A(N);
  for (i = 1; i <= N; i++) A[i - 1] = i;
  for (i = 0; i < N; i++) {
    if (A[i] == P[i]) {
      same_streak += 1;
    } else {
      if (same_streak == 1) {
        result += 1;
      } else if (same_streak > 1) {
        result += same_streak - 1;
      }
      same_streak = 0;
    }
  }
  if (same_streak == 1) {
    result += 1;
  } else if (same_streak > 1) {
    result += same_streak - 1;
  }
  cout << result << endl;
}
