#include <bits/stdc++.h>
using namespace std;
const int INF = (int)2e9;
const double EPS = (double)1e-9;
const double PI = (double)acos(-1.0);
const long long MOD = (long long)1e9 + 7;
int main() {
  int n;
  scanf("%d", &n);
  int temp;
  int count = 0;
  int arr[n + 2];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (i + 1 < n && arr[i] == i && arr[i + 1] == i + 1) {
      count++;
      i++;
    } else if (arr[i] == i) {
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
