#include <iostream>
using namespace std;

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-1; i++) {
    if (p[i] == i) {
      swap(p[i], p[i+1]);
      ans++;
    }
  }
  cout <<(p[n-1] == n-1 ? ans+1 : ans) << endl;
}