#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  int cnt = 0;
  int idx = 0;
  while (idx < n - 1) {
    if (p[idx] == idx) {
      cnt++;
      swap(p[idx], p[idx + 1]);
    }
    idx++;
  }
  cout << cnt << "\n";
  return 0;
}
