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