#include <bits/stdc++.h>
using namespace std;
void swap(int &a, int &b) {
  int c = a;
  a = b;
  b = c;
}
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  int ans = 0;
  for (int i = 0; i < n; i++) cin >> p.at(i);
  if (p.at(0) == 1) {
    swap(p.at(0), p.at(1));
    ans++;
  }
  for (int i = 1; i < n; i++) {
    if (p.at(i) == i + 1) {
      swap(p.at(i), p.at(i - 1));
      ans++;
    }
  }
  cout << ans << endl;
}
