#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[100100];
  int N;
  cin >> N;
  for (int n = 0; n < N; n++) {
    cin >> a[n];
  }
  int ans = 0;
  for (int n = 0; n < N; n++) {
    if (n != N - 1) {
      if (a[n] == n + 1) {
        swap(a[n], a[n + 1]);
        ans++;
      }
    } else {
      if (a[n] == a[n + 1]) {
        swap(a[n], a[n - 1]);
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
