#include <bits/stdc++.h>
#pragma target("avx")
using namespace std;
constexpr long long INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr long long LINF = 1e18;
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
long long n, cnt, ans, a[ohara], b, c, d, tmp, m, h, w, x, y, sum, k, q;
int main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (long long(i) = 0; (i) < (int)(n); (i)++) {
    cin >> a[i];
    a[i]--;
  }
  for (long long(i) = 0; (i) < (int)(n - 1); (i)++) {
    if (a[i] == i || a[i + 1] == i + 1) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << (ans) << endl;
  return 0;
}
