#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int arr[n + 1];
  for (int i = 1; i <= n; ++i) cin >> arr[i];
  int ans = 0;
  for (int i = 1; i <= n - 1; ++i) {
    if (arr[i] == i) {
      ans++;
      swap(arr[i], arr[i + 1]);
    }
  }
  return cout << ans << "\n", 0;
}
