#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const double eps = 1e-6;
int a[maxn];
int main() {
  int n, a[110];
  cin >> n;
  int cnt = 0;
  for (int i = 1; i < n + 1; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i < n + 1; i++) {
    if (i == a[i] && i < n)
      swap(a[i], a[i + 1]), cnt++;
    else if (i == a[i] && i == n)
      swap(a[i], a[i - 1]), cnt++;
  }
  cout << cnt << endl;
}
