#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  int p[110000];
  int cnt = 0;
  for (int i = 1; i <= N; i++) cin >> p[i];
  for (int i = 1; i <= N; i++) {
    if (i != 1) {
      if (i - 1 == p[i - 1]) {
        continue;
      }
    }
    if (i == p[i]) {
      ++cnt;
    }
  }
  cout << cnt << endl;
  return 0;
}
