#include <bits/stdc++.h>
const int MOD = 1000000007;
using namespace std;
int main() {
  int n;
  int count = 0;
  cin >> n;
  vector<int> p(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> p[i];
  }
  for (int(i) = 0; (i) < (n - 1); (i)++) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
