#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int findGCD(int arr[], int n) {
  int result = arr[0];
  for (int i = 1; i < n; i++) result = gcd(arr[i], result);
  return result;
}
template <typename T>
T lcm(T m, T n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  fill((T *)array, (T *)(array + N), val);
}
int dx[5] = {1, 0, -1, 0};
int dy[5] = {0, 1, 0, -1};
bool IsPrime(int num) {
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) {
      return false;
    }
  }
  return true;
}
int d[127];
int main() {
  int N;
  int ans = 0;
  int p[100005];
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> p[i];
  }
  for (int i = 1; i < N; i++) {
    int temp;
    if ((i + 1 != N + 1) && (p[i] == i) && (p[i + 1] == i + 1)) {
      temp = p[i];
      p[i + 1] = p[i];
      p[i] = temp;
      ans++;
    } else if ((i + 1 != N + 1) && (p[i] == i)) {
      temp = p[i];
      p[i + 1] = p[i];
      p[i] = temp;
      ans++;
    } else if ((i + 1 != N + 1) && (p[i + 1] == i + 1)) {
      ;
    }
  }
  cout << ans << endl;
  return 0;
}
