#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a == i + 1) A.push_back(a);
  }
  if (A.size() == 0) {
    cout << 0 << endl;
    return 0;
  } else if (A.size() == 1) {
    cout << 1 << endl;
    return 0;
  }
  int ans = A.size();
  for (int i = 0; i < A.size() - 1; i++) {
    if (A[i] + 1 == A[i + 1]) ans--;
  }
  cout << ans << endl;
}
