#include <bits/stdc++.h>
using namespace std;
vector<bool> f;
int main() {
  int n;
  int cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    if (i == a)
      f.push_back(true);
    else
      f.push_back(false);
  }
  f.erase(unique(f.begin(), f.end()), f.end());
  for (int i = 0; i < f.size(); i++) {
    if (f[i] == true) cnt++;
  }
  cout << cnt << endl;
  return (0);
}
