#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  ll count = 0;
  for (int i = 0; i < N; i++) {
    ll a;
    cin >> a;
    if (a != i + 1) {
      count++;
      i++;
      N--;
    }
  }
  cout << count << endl;
}
