#include <bits/stdc++.h>
using namespace std;
int C[20];
int main() {
  int N, temp, ans = 0;
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> temp;
    if (temp == i) {
      ans++;
      i++;
    }
  }
  cout << ans << endl;
}
