#include <bits/stdc++.h>
using namespace std;
using vvll = vector<vector<long long>>;
long long mod = 1000000007;
template <typename TypeInt>
string itob(const TypeInt v, int base) {
  static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  string ret;
  static numeric_limits<TypeInt> t;
  TypeInt n = v;
  if (t.is_signed) {
    if (v < 0) n *= -1;
  }
  while (n >= base) {
    ret += table[n % base];
    n /= base;
  }
  ret += table[n];
  if (t.is_signed) {
    if (v < 0 && base == 10) ret += '-';
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int ctoi(char c) { return c - '0'; }
int gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int lcm(long long a, long long b) { return a * b / gcd(a, b); }
bool primecheck(long long n) {
  if (n < 2)
    return false;
  else {
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) return false;
    }
    return true;
  }
}
string reverserange(string s, long long a, long long b) {
  reverse(s.begin() + a - 1, s.begin() + b);
  return s;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  int che = 0;
  for (int i = 1; i < n; i++) {
    if (a.at(i - 1) == i) {
      if (a.at(i) == i + 1) {
        che++;
        i++;
        continue;
      }
      che++;
    }
  }
  cout << che << endl;
}
