#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int p[100010] = {0};
int main() {
  int N, a[100010];
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N - 1; i++) {
    if (a[i] == i + 1) {
      p[i] = 1;
    }
  }
  for (int i = 0; i < N; i++) {
    if (i != N - 1) {
      if (a[i] == i + 1 && a[i + 1] == i + 2) {
        ans += 2;
        i++;
      } else if (a[i] == i + 1) {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
}
