#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int A[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    if (A[i] == i) {
      v.push_back(i);
    }
  }
  int m = v.size(), cnt = 0;
  for (int i = 0; i < m - 1; i++) {
    if (v[i] + 1 == v[i + 1]) {
      cnt++;
      i++;
    } else {
      if (i == m - 2) cnt++;
      cnt++;
    }
  }
  cout << cnt << "\n";
  return 0;
}
