#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 100, mod = 1e9 + 7, INF = 1ll << 62;
long long a[maxn];
bool mark[maxn];
int main() {
  long long n, t = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == i) {
      mark[i] = 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (mark[i] == 1) {
      mark[i] = 0;
      t++;
      if (i == 1) {
        swap(a[1], a[2]);
        if (mark[2] == 1) {
          mark[2] = 0;
        }
      }
      if (i == n) {
        swap(a[n], a[n - 1]);
      } else {
        if (mark[i + 1] == 1) {
          mark[i + 1] == 0;
        }
      }
    }
  }
  cout << t;
}
