#include <bits/stdc++.h>
#pragma gcc optimize("Ofast")
using namespace std;
using ll = long long;
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;
}
const long long MOD = 1000000007;
const long long INF = 1061109567;
const double EPS = 1e-10;
const double PI = acos(-1.0);
long long gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
string toStrUp(string str) {
  char diff = 'A' - 'a';
  for (long long i = (0); i < (str.size()); ++i) str[i] += diff;
  return str;
}
string gCh(string str, long long key) { return str.substr(key, 1); }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n = 0, m = 0, a = 0, b = 0, c = 0, d = 0, x = 0, y = 0, z = 0;
  string s = "", t = "";
  cin >> n;
  vector<ll> p(n);
  for (long long i = 0; i < (p).size(); i++) {
    cin >> (p).at(i);
  }
  for (long long i = (1); i < (n); ++i) {
    if (i == p[i - 1]) {
      swap(p[i - 1], p[i]);
      z++;
    }
  }
  cout << z << '\n';
}
