#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (ll i = (0), __last_i = (v.size()); i < __last_i; i++) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
  for (ll i = (0), __last_i = (v.size()); i < __last_i; i++) {
    if (i) os << endl;
    os << v[i];
  }
  return os;
}
int main() {
  ll n;
  vector<ll> v;
  ll ans = 0;
  cin >> n;
  for (ll i = (0), __last_i = (n); i < __last_i; i++) {
    ll p;
    cin >> p;
    v.push_back(p);
  }
  if (v[0] == 1) {
    swap(v[0], v[1]);
    ans++;
  }
  for (ll i = (1), __last_i = (v.size()); i < __last_i; i++) {
    if (v[i] == i + 1) {
      swap(v[i], v[i - 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
