#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = (int)1e9;
int main() {
  int n;
  cin >> n;
  vector<int> p(n + 1);
  vector<bool> b(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
    if (i == p[i]) {
      b[i] = false;
    } else {
      b[i] = true;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (!b[i]) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
