#include <bits/stdc++.h>
using namespace std;
int N, b, cnt, tmp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  for (int i = 1; i <= N; i++) {
    int x;
    cin >> x;
    if (b) {
      cnt++;
      x = tmp;
    }
    b = (i == x);
    tmp = x;
  }
  cout << cnt;
  return 0;
}
