#include <bits/stdc++.h>
using namespace std;
int main() {
  int num[100005];
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> num[i];
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (num[i] == i) {
      ans++;
      int t = num[i];
      num[i] = num[i + 1];
      num[i + 1] = t;
    }
  }
  cout << ans << endl;
  return 0;
}
