#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
using ll = long long;
const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9 = 1000000000;
const ll mod = 1000000007;
int main() {
  int n;
  cin >> n;
  int count = 0;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  int cnt = 0;
  if (a[0] == 1) cnt++;
  for (int i = 0; i < n - 1; ++i) {
    if (a[i] == i + 1) {
      cnt++;
      swap(a[i], a[i + 1]);
    }
  }
  if (a[n - 1] == n) cnt++;
  cout << cnt << endl;
}
