#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, ans = 0;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i = 0; i < N; i++) {
    if (A.at(i) == i + 1) {
      int a = A.at(i);
      int b = A.at(i + 1);
      A.at(i) = b;
      A.at(i + 1) = a;
      ans++;
    }
  }
  cout << ans << endl;
}
