#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 10;
int p[MAX_N];
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (p[i] != i + 1) continue;
    if (i == 0)
      swap(p[i], p[i + 1]);
    else if (i == n - 1)
      swap(p[i], p[i - 1]);
    else {
      if (p[i - 1] < i + 1)
        swap(p[i], p[i - 1]);
      else if (p[i + 1] > i + 1)
        swap(p[i], p[i + 1]);
      else {
        if (abs(p[i] - p[i - 1]) > abs(p[i] - p[i + 1]))
          swap(p[i], p[i - 1]);
        else
          swap(p[i], p[i + 1]);
      }
    }
    ans++;
  }
  cout << ans << endl;
  return 0;
}
