#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, buf, in = 0, m = -1, c = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> buf;
    if (buf == i + 1) {
      c++;
      if (m != -1 && buf - m == 1 && in == 0) {
        c--;
        in = 1;
      }
      m = buf;
    } else if (in == 1) {
      in = 0;
    }
  }
  cout << c;
  return 0;
}
