#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1e9 + 7;
static const long long INF = 1e25;
static const int MAX = 4;
long long p[100001];
bool q[100001];
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    q[i] = (p[i] == i + 1);
  }
  long long cnt = 0;
  for (int i = 0; i < n - 1; i++) {
    if (q[i] || q[i + 1]) {
      swap(q[i], q[i + 1]);
      q[i] = q[i + 1] = false;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
