#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<int> p(n);
  vector<int> c;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    if (p[i] == i + 1) {
      c.push_back(i);
    }
  }
  cnt += c.size();
  if (cnt != 0) {
    for (int i = 0; i < c.size() - 1; i++) {
      if (c[i] + 1 == c[i + 1]) {
        cnt--;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
