#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  int arr[100001];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int out = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i] == i && i != n) {
      arr[i] = i + 1;
      arr[i + 1] = i;
      out++;
    } else if (arr[i] == n) {
      arr[i] = arr[i - 1];
      arr[i - 1] = n;
      out++;
    }
  }
  cout << out;
  return 0;
}
