#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
int n, a[100000];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i], a[i]--;
  int sol = 0;
  for (int i = 1; i < n; ++i) {
    if (a[i - 1] == i - 1) swap(a[i], a[i - 1]), sol++;
  }
  cout << sol;
}
