#include <iostream>
using namespace std;
#define ll long long

int main () {
  int n;
  cin >> n;
  int p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i];  
    p[i]--;
  } 
  int ans = 0; 
  for (int i = 0; i < n; i++) {
    if (i == p[i]) {
      swap(p[i], p[i + 1]);
      ans++;  
    } 
  }
  cout << ans << endl;
}