#include <bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1e9;
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int N;
  cin >> N;
  int p[100002];
  p[0] = 0;
  p[100001] = 100001;
  for (int i = 1; i <= N; ++i) cin >> p[i];
  int ans = 0;
  for (int i = 1; i <= N; ++i) {
    if (p[i] == i && p[i - 1] != i - 1) {
      ans += 1;
      swap(p[i], p[i - 1]);
    } else if (p[i] == i) {
      ans += 1;
      swap(p[i], p[i + 1]);
    }
  }
  cout << ans << endl;
  return 0;
}
