#include <bits/stdc++.h>
using namespace std;
vector<long long int> ar;
int main() {
  long long int n, i, ans = 0, a;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a;
    if (a == i) {
      ar.push_back(i);
    }
  }
  cout << ar.size() - 1;
  return 0;
}
