#include <bits/stdc++.h>
using namespace std;
int n, p[100010];
int ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == i + 1) {
      if (p[i + 1] == i + 2) swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  system("pause");
  return 0;
}
