#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const bool test = false;
long long dx[] = {1, 0, -1, 0};
long long dy[] = {0, 1, 0, -1};
const long long inf = (long long)1 << 60;
const long long undefined = inf;
const ll INFL = (ll)1 << 60;
ll mod_n = (long long)1e9 + 7;
const long double eps = 1e-10;
long long sgn(const long double& r) { return (r > eps) - (r < -eps); }
long long sgn(const long double& a, const long double& b) { return sgn(a - b); }
const long long MAX = (long long)2e5 + 5;
vector<string> split(const string& str, char sep) {
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep)) {
    v.push_back(buffer);
  }
  return v;
}
template <typename T>
string join(
    const vector<T>& v, const string delim = 0,
    function<string(T)> f = [](long long a) { return to_string(a); }) {
  string s;
  if (!v.empty()) {
    s += f(v[0]);
    for (decltype(v.size()) i = 1, c = v.size(); i < c; ++i) {
      if (delim != "") s += delim;
      s += f(v[i]);
    }
  }
  return s;
}
string join_str(const vector<string>& v, const string delim = 0) {
  return join<string>(v, delim, [](string a) { return a; });
}
string operator*(const string& s, const long long& n) {
  string res = "";
  for (long long i = 0; i < (long long)(n); ++i) res += s;
  return res;
}
template <class InputIterator>
long long sum(InputIterator begin, InputIterator end) {
  return accumulate(begin, end, 0ll);
}
template <typename T>
T gcd(T a, T b) {
  if (a == inf) return b;
  if (b == inf) return a;
  T c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
template <typename T>
T lcm(T m, T n) {
  return ((m / gcd(m, n)) * n);
}
template <typename T>
T bit_count(T N) {
  T cnt = 0;
  while (N) {
    if (N & 1) cnt++;
    N >>= 1;
  }
  return cnt;
}
template <typename T>
void print_vec(ostream& ostream, vector<T> a) {
  for (long long i = 0; i < (long long)(a.size() - 1); ++i)
    ostream << a[i] << " ";
  ostream << a.back() << endl;
}
ll pow_n(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
template <class T, class U>
T mod_pow(T x, U n) {
  T res = 1;
  while (n > 0) {
    if (n & 1) res = res * x;
    x = x * x;
    x %= mod_n;
    n >>= 1;
    res %= mod_n;
  }
  return res;
}
template <class T>
T mod_rev(T a) {
  T res = 1;
  return mod_pow(a, mod_n - 2);
}
long long H, W;
bool grid_ng(long long y, long long x) {
  return y < 0 || y >= H || x < 0 || x >= W;
}
struct Point {
  long long x, y;
  Point(long long y_, long long x_) : y(y_), x(x_) {}
  bool operator<(const Point& r) const {
    if (y != r.y) return y < r.y;
    return x < r.x;
  }
};
struct Vertex {
  long long id, dist;
  bool operator>(const Vertex& r) const { return dist > r.dist; }
};
struct Edge {
  long long to, weight;
  Edge(long long to, long long weight) : to(to), weight(weight) {}
};
using Graph = vector<vector<Edge>>;
Graph g;
long long n, k;
vector<long long> p;
class Solver {
 public:
  void solve() {
    cin >> n;
    p.resize(n + 1);
    for (long long i = (1); i < (long long)(n + 1); ++i) cin >> p.at(i);
    long long res = 0;
    for (long long i = (1); i < (long long)(n); ++i) {
      if (p.at(i) == i || p.at(i + 1) == i + 1) {
        swap(p.at(i), p.at(i + 1));
        res++;
      }
    }
    cout << res << endl;
  }
};
signed main() {
  srand((unsigned long long)time(NULL));
  cout << fixed << setprecision(20);
  cerr << fixed << setprecision(3);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  return 0;
}
