#include <bits/stdc++.h>
using namespace std;
long long int N, p[100001] = {}, num = 0;
bool flag[100001] = {};
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> p[i];
    if (p[i] == i) {
      num++;
      if (flag[i - 1]) num--;
      flag[i] = true;
    }
  }
  cout << num << endl;
  return 0;
}
