#include <bits/stdc++.h>
using namespace std;
const long long INF = (int)1e17 + 7;
int a[100009], ar[100009];
int ans;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == i) {
      ar[i]++;
    }
  }
  for (int i = 1; i < n; i++) {
    if (ar[i] == 1 && ar[i + 1] == 1) {
      ans++;
      i++;
    } else if (ar[i] == 1) {
      ans++;
    }
  }
  if (ar[n] == 1) {
    ans++;
  }
  cout << ans;
}
