#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmin(T& a, const T& b) {
  a = min(a, b);
}
template <class T>
void chmax(T& a, const T& b) {
  a = max(a, b);
}
const double EPS = 1e-9;
const long INF = 999999999;
const long MOD = 1000000007;
int dy[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dx[] = {1, -1, 0, 0, 1, -1, -1, 1};
int main() {
  int N, number[100001] = {}, result = 0;
  cin >> N;
  for (int i = 0; i < (N); i++) cin >> number[i];
  for (int i = 0; i < (N - 1); i++) {
    if (number[i] == i + 1) {
      swap(number[i], number[i + 1]);
      result++;
    }
  }
  printf("%d\n", result);
  return 0;
}
