#include <bits/stdc++.h>
using namespace std;
vector<int> check(vector<int> &input) {
  vector<int> ret;
  for (int i = 0; i < input.size(); i++) {
    if (input[i] == i + 1) {
      ret.push_back(i);
    }
  }
  return ret;
}
void swap(int &a, int &b) {
  int temp;
  temp = a;
  a = b;
  b = temp;
}
int main(void) {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    v.push_back(k);
  }
  vector<int> r = check(v);
  if (r.size() == 0) {
    cout << 0;
    return 0;
  }
  int count = 0;
  int maxind = v.size() - 1;
  while (r.size() != 0) {
    if (r[0] == 0) {
      swap(v[0], v[1]);
      count++;
      r = check(v);
      continue;
    }
    if (r[0] == maxind) {
      swap(v[maxind - 1], v[maxind]);
      count++;
      r = check(v);
      continue;
    }
    int center = r[0] - 1;
    swap(v[center], v[center + 1]);
    count++;
    r = check(v);
    continue;
  }
  cout << count;
  return 0;
}
