#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;
int main() {
  int n, cnt = 0;
  cin >> n;
  vector<int> arr(n), ar(n), tmp;
  iota(ar.begin(), ar.end(), 1);
  for (int i = 0; i < (int)(n); i++) cin >> arr[i];
  tmp = arr;
  for (int i = 0; i < (int)(n - 1); i++)
    if (ar[i] == arr[i]) swap(arr[i], arr[i + 1]);
  cnt++;
  if (arr[n - 1] == ar[n - 1]) cnt++;
  cout << cnt << endl;
  return 0;
}
