#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> p(n, 0);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == i + 1) p[i] = 1;
  }
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == 1) {
      p[i + 1] = 0;
      ans++;
    }
  }
  cout << ans << endl;
}
