#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
const long long mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
long long gcd(long long A, long long B) {
  if (B == 0) return A;
  return gcd(B, A % B);
}
long long lcm(long long A, long long B) { return A * B / gcd(A, B); }
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (long long int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  int count = 0;
  for (long long int i = 1; i < n; i++) {
    if (p[i - 1] == i - 1) {
      swap(p[i - 1], p[i]);
      count++;
    }
  }
  cout << count << endl;
}
