#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long int ans = 0;
  for (long long int i = 0; i < n - 1; i++) {
    if (v[i] == i + 1) {
      long long int temp = v[i];
      v[i] = v[i + 1];
      v[i + 1] = temp;
      ans++;
    }
  }
  cout << ans << endl;
}
