#include <bits/stdc++.h>
using namespace std;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;
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;
}
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
template <typename T>
T seinomi(T a) {
  if (a > 0) {
    return a;
  } else {
    return 0;
  }
}
template <typename T>
map<T, T> soinsuubunkai(T n) {
  map<T, T> ret;
  for (T i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
template <typename T>
T ketasuu(T num) {
  return std::to_string(num).length();
}
long long kaizyou(long long k) {
  long long sum = 1;
  for (long long i = 1; i <= k; ++i) {
    sum *= i;
  }
  return sum;
}
long long modkaizyou(long long k) {
  long long sum = 1;
  for (int i = 1; i <= k; ++i) {
    sum *= i;
    sum = sum % mod;
  }
  return sum;
}
template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value) {
  while (first != last) {
    *first++ = value;
    ++value;
  }
}
long long llpow(long long a, long long n) {
  long long rep = a;
  for (long long i = 1; i < n; i++) {
    rep *= a;
  }
  return rep;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
template <typename T>
T amarinasi(T a, T b) {
  if (a % b == 0) {
    return a / b;
  } else if (a % b > 0) {
    return a / b + 1;
  } else {
    return a / b - 1;
  }
}
vector<vector<long long>> nCr_v(5010, vector<long long>(5010, 0));
bool nCr_maekeisan = false;
void nCr_Calculater() {
  for (int i = 0; i < nCr_v.size(); i++) {
    nCr_v[i][0] = 1;
    nCr_v[i][i] = 1;
  }
  for (int k = 1; k < nCr_v.size(); k++) {
    for (int j = 1; j < k; j++) {
      nCr_v[k][j] = (nCr_v[k - 1][j - 1] + nCr_v[k - 1][j]);
    }
  }
}
long long nCr(long long n, long long r) {
  if (n > 5010 || n < 0 || r > 5010 || r < 0) {
    cout << "Error!! n or r is over 5010 or under 0" << endl;
    return 1;
  } else {
    if (nCr_maekeisan == false) {
      nCr_Calculater();
      nCr_maekeisan = true;
    }
    return nCr_v[n][r];
  }
}
vector<long long> modnCr_fac(1000010), modnCr_finv(1000010),
    modnCr_inv(1000010);
bool modnCr_maekeisan = false;
void COMinit() {
  modnCr_fac[0] = modnCr_fac[1] = 1;
  modnCr_finv[0] = modnCr_finv[1] = 1;
  modnCr_inv[1] = 1;
  for (int i = 2; i < 1000010; i++) {
    modnCr_fac[i] = modnCr_fac[i - 1] * i % mod;
    modnCr_inv[i] = mod - modnCr_inv[mod % i] * (mod / i) % mod;
    modnCr_finv[i] = modnCr_finv[i - 1] * modnCr_inv[i] % mod;
  }
}
long long COM(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return modnCr_fac[n] * (modnCr_finv[k] * modnCr_finv[n - k] % mod) % mod;
}
long long modnCr(long long n, long long r) {
  if (modnCr_maekeisan == false) {
    COMinit();
    modnCr_maekeisan = true;
  }
  return COM(n, r);
}
long long nPr(long long n, long long r) {
  r = n - r;
  long long sum = 1;
  long long i;
  for (i = n; i >= r + 1; i--) sum *= i;
  return sum;
}
long long nHr(long long n, long long r) { return modnCr(r + n - 1, r); }
double to_deg(double r) { return r * 180.0 / (atan(1.0) * 4.0); }
double kakudo(double dx, double dy) {
  return atan2(dx, dy) * 180.0 / (atan(1.0) * 4.0);
}
vector<long long> yakusuu(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
std::vector<bool> sosuuhantei(long long max) {
  vector<bool> ret;
  if (max + 1 > ret.size()) {
    ret.resize(max + 1, true);
  }
  ret[0] = false;
  ret[1] = false;
  for (long long i = 2; i * i <= max; ++i) {
    if (ret[i]) {
      for (long long j = 2; i * j <= max; ++j) {
        ret[i * j] = false;
      }
    }
  }
  return (ret);
}
std::vector<long long> sosuurekkyo(long long max) {
  vector<bool> tmp;
  vector<long long> ret;
  if (max + 1 > tmp.size()) {
    tmp.resize(max + 1, true);
  }
  tmp[0] = false;
  tmp[1] = false;
  for (long long i = 2; i * i <= max; ++i) {
    if (tmp[i]) {
      for (long long j = 2; i * j <= max; ++j) {
        tmp[i * j] = false;
      }
    }
  }
  for (long long i = 0; i <= max; i++) {
    if (tmp[i]) {
      ret.push_back(i);
    }
  }
  return (ret);
}
long long nisinsize(long long n) {
  long long rep = 0;
  long long tmp = 1;
  while (1) {
    rep++;
    tmp *= 2;
    if (tmp > n) {
      break;
    }
  }
  return rep;
}
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 0; i < n - 1; i++) {
    if (a[i] == i + 1 && a[i + 1] == i + 2) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  for (long long i = 0; i < n - 1; i++) {
    if (a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
