#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<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 == 0) {
      if (i == P[i]) {
        swap(P[i], P[i + 1]);
        ans++;
      }
    } else if (i == N - 1) {
      if (i == P[i]) {
        swap(P[i], P[i - 1]);
        ans++;
      }
    } else {
      if (i == P[i]) {
        if (P[i - 1] != i - 1) {
          swap(P[i - 1], P[i]);
          ans++;
        } else {
          swap(P[i], P[i + 1]);
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}
