#include <bits/stdc++.h>
using namespace std;
int main() {
  int max_n = 100000;
  int P[max_n];
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> P[i];
  }
  int swap = 0;
  for (int i = 0; i < N; i++) {
    if (P[i] == i + 1) {
      swap++;
    }
  }
  cout << swap << endl;
  return 0;
}
