#include <bits/stdc++.h>
using namespace std;
int dy[4] = {1, 0, -1, 0};
int dx[4] = {0, 1, 0, -1};
vector<vector<int>> graph;
bool sort_sec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.second < b.second) {
    return true;
  }
  return false;
}
int main(void) {
  int N;
  cin >> N;
  vector<int> p(N + 1);
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (p[i] == i + 1) ans++;
    if (p[i] == i + 1 && p[i + 1] == i + 2) ans--;
  }
  cout << ans << endl;
  return 0;
}
