#include <bits/stdc++.h>
using namespace std;
long long int modpow(long long int a, int n) {
  if (n == 0) return 1;
  if (n == 1) return a;
  long long int wk = modpow(a, n / 2);
  long long int ret = 0;
  if (n % 2 == 0) {
    ret = 1;
  } else {
    ret = a;
  }
  return (((ret * wk) % 1000000007) * wk) % 1000000007;
}
long long int gcd(long long int a, long long int b) {
  long long int tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  long long int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long int lcm(long long int a, long long int b) {
  long long int wk_int;
  wk_int = (a * b) % 1000000007;
  long long int ret;
  ret = (wk_int * modpow(gcd(a, b), 1000000007 - 2)) % 1000000007;
  return ret;
}
bool isPrime(int n) {
  if (n == 1) return false;
  if (n == 2) return true;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  int ans = 0;
  int tmp;
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == i + 1 || p[i + 1] == i + 2) {
      ans++;
      tmp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = tmp;
    }
  }
  cout << ans << endl;
  return 0;
}
