#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;
struct __INIT {
  __INIT() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} __init;
int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++) cin >> P[i];
  vector<bool> ok(N);
  for (int i = 0; i < N; i++) {
    ok[i] = P[i] != i + 1;
  }
  int sum = 0;
  for (int i = 0; i < N - 1; i++) {
    if (!ok[i] or !ok[i + 1]) {
      sum++;
      ok[i + 1] = true;
    }
  }
  cout << sum << endl;
}
