#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 0x3c3c3c3c;
const long long infl = 0x3c3c3c3c3c3c3c3c;
int N;
int A[100003];
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i]--;
  }
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if (A[i] == i || A[i + 1] == i + 1) swap(A[i], A[i + 1]), ans++;
  }
  cout << ans;
  return 0;
}
