#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long INFL = 0x3f3f3f3f3f3f3f3f;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long lcm(long long x, long long y) {
  long long g = gcd(x, y);
  return x / g * y;
}
using Graph = vector<vector<int>>;
Graph G;
int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (long long i = 0; i < (n); i++) cin >> vec[i];
  int sum1 = 0;
  for (int i = 0; i < n - 1;) {
    int a = vec[i];
    int b = vec[i + 1];
    if (a == i + 1) {
      vec[i] = b;
      vec[i + 1] = a;
      sum1++;
      i += 2;
    } else
      i++;
  }
  cout << sum1 << endl;
}
