#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
ll MOD = 1e9 + 7;
ll INF = 1e18;
using std::swap;
int main() {
  int n;
  cin >> n;
  vector<ll> vec(n);
  int c = 0;
  vector<ll> reg;
  for (int i = 0; i < (int)(n); i++) {
    int x;
    cin >> x;
    if (i + 1 == x) {
      c++;
      swap(vec[i], vec[i + 1]);
    }
  }
  cout << c << endl;
}
