#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100000], n, i, count = 0, last = 999999, now;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == i) {
      now = i;
      if (now != last + 1) {
        count++;
        last = 999999;
      } else
        last = i;
    }
  }
  cout << count;
}
