#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = (long long)1000000007 * 1000000007;
const double EPS = 1e-9;
const long double eps = 1e-11;
const long double pi = acos(-1.0);
int main() {
  int n;
  cin >> n;
  int a[100000];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int cnt = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
