#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a == 0 || b == 0) return 0;
  if (a == b) return a;
  if (a > b) return gcd(a - b, b);
  return gcd(a, b - a);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int arr[100005];
  long long int n, k = 0;
  cin >> n;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    if (arr[i] == i) {
      swap(arr[i], arr[i + 1]);
      k++;
    }
  }
  cout << k << endl;
  return 0;
}
