#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7LL;
const int INF = 2e9;
int N, A[100005];
int main() {
  cin.tie(0), cout.tie(0), ios::sync_with_stdio(0),
      cout << fixed << setprecision(20);
  ;
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> A[i];
  int cnt = 0;
  bool flag = false;
  for (int i = 0; i < N; ++i) {
    if (A[i] == i + 1) {
      if (flag) {
        cnt++;
        flag = false;
      } else {
        flag = true;
      }
    } else {
      if (flag) {
        cnt++;
        flag = false;
      }
    }
  }
  cout << cnt << "\n";
  return 0;
}
