#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 5;
long long a[maxn];
signed main() {
  long long n, cnt = 0;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i < n; i++)
    if (a[i] == i && a[i + 1] == i + 1) swap(a[i], a[i + 1]), cnt++;
  if (a[1] == 1) swap(a[1], a[2]), cnt++;
  for (long long i = 2; i < n; i++)
    if (a[i] == i) swap(a[i], a[i - 1]), cnt++;
  cout << cnt << endl;
  return 0;
}
