#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long a[maxn], b[maxn];
int inverse(int n) {
  int b = log10(n), c = n;
  int sum, sum1 = 0, sum2;
  for (int i = 0; i <= b; i++) {
    sum = c % 10;
    sum1 = sum1 * 10 + sum;
    c /= 10;
  }
  if (sum1 == n)
    return 0;
  else
    return -1;
}
int main() {
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  if (a[0] == 1) {
    swap(a[0], a[1]);
    sum++;
  }
  for (int i = 1; i < n; i++) {
    if (a[i] == i + 1) {
      if (a[i] > a[i - 1]) {
        swap(a[i], a[i - 1]);
        sum++;
      } else {
        swap(a[i], a[i + 1]);
        sum++;
      }
    }
  }
  printf("%d\n", sum);
  return 0;
}
