#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int n;
  cin >> n;
  int isChange = false;
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (isChange) {
      cnt++;
      isChange = false;
    } else {
      int val;
      cin >> val;
      if (val - 1 == i) {
        isChange = true;
        if (i == n - 1) {
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
